├── import ├── blue.png ├── blue@2x.png ├── blue.css ├── icheck.min.js ├── purl.js └── underscore-min.js ├── docs ├── icons │ ├── 源文件.psd │ ├── 16边缘空白.png │ ├── 128128无空白.JPG │ └── 128128无空白.png ├── assets │ ├── comment.png │ └── favorites.png ├── screenshots │ ├── 快速屏蔽.png │ ├── 功能开关选项.png │ ├── 快速黑名单.png │ ├── 搜索框增强.png │ ├── 首页调整预览.png │ ├── 功能开关选项_s.png │ ├── 回答目录&预览.png │ ├── 收藏夹地址清单.png │ ├── 消息通知下拉列表.png │ ├── 用户回答地址清单.png │ ├── 首页动态过滤选项.png │ ├── 于回答右侧展开评论列表.png │ ├── 「我要回答」快速跳转链接.png │ └── 原有评论框底部添加「收起」按钮.png ├── prototype │ ├── comment.png │ ├── favorites.png │ ├── assets │ │ ├── comment.png │ │ └── favorites.png │ ├── favorites.bmml │ └── comment.bmml └── .gitCfg.bat ├── misc ├── xpi-config │ ├── icon.png │ ├── icon64.png │ ├── test │ │ └── test-main.js │ ├── lib │ │ └── main.js │ └── package.json ├── crx-config │ ├── icon128.png │ ├── icon16.png │ ├── icon48.png │ └── manifest.json └── ext-config │ ├── icon-48.png │ ├── icon-64.png │ ├── icon-128.png │ ├── Settings.plist │ └── Info.plist ├── src ├── pages │ ├── README.md │ ├── collection.js │ ├── answer.js │ ├── settingsFilter.js │ ├── question.js │ ├── settings.js │ └── home.js ├── begin.js ├── end.js ├── meta.js ├── modules │ ├── SearchingList.js │ ├── TopNav.js │ ├── Noti7.js │ ├── allLinks.js │ ├── Answer.js │ ├── QuickFavo.js │ └── QuickBlock.js ├── lib │ └── utils.js └── izhihu.js ├── dist ├── README.md └── iZhihu for Chrome.pem ├── package.json ├── grunt ├── README.md └── config.js ├── test └── answer_shift.css ├── Gruntfile.js ├── LICENSE.md ├── .gitignore └── README.md /import/blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unogz/izhihu/HEAD/import/blue.png -------------------------------------------------------------------------------- /docs/icons/源文件.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unogz/izhihu/HEAD/docs/icons/源文件.psd -------------------------------------------------------------------------------- /import/blue@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unogz/izhihu/HEAD/import/blue@2x.png -------------------------------------------------------------------------------- /docs/icons/16边缘空白.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unogz/izhihu/HEAD/docs/icons/16边缘空白.png -------------------------------------------------------------------------------- /docs/assets/comment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unogz/izhihu/HEAD/docs/assets/comment.png -------------------------------------------------------------------------------- /docs/assets/favorites.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unogz/izhihu/HEAD/docs/assets/favorites.png -------------------------------------------------------------------------------- /docs/icons/128128无空白.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unogz/izhihu/HEAD/docs/icons/128128无空白.JPG -------------------------------------------------------------------------------- /docs/icons/128128无空白.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unogz/izhihu/HEAD/docs/icons/128128无空白.png -------------------------------------------------------------------------------- /docs/screenshots/快速屏蔽.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unogz/izhihu/HEAD/docs/screenshots/快速屏蔽.png -------------------------------------------------------------------------------- /misc/xpi-config/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unogz/izhihu/HEAD/misc/xpi-config/icon.png -------------------------------------------------------------------------------- /docs/prototype/comment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unogz/izhihu/HEAD/docs/prototype/comment.png -------------------------------------------------------------------------------- /docs/screenshots/功能开关选项.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unogz/izhihu/HEAD/docs/screenshots/功能开关选项.png -------------------------------------------------------------------------------- /docs/screenshots/快速黑名单.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unogz/izhihu/HEAD/docs/screenshots/快速黑名单.png -------------------------------------------------------------------------------- /docs/screenshots/搜索框增强.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unogz/izhihu/HEAD/docs/screenshots/搜索框增强.png -------------------------------------------------------------------------------- /docs/screenshots/首页调整预览.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unogz/izhihu/HEAD/docs/screenshots/首页调整预览.png -------------------------------------------------------------------------------- /misc/crx-config/icon128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unogz/izhihu/HEAD/misc/crx-config/icon128.png -------------------------------------------------------------------------------- /misc/crx-config/icon16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unogz/izhihu/HEAD/misc/crx-config/icon16.png -------------------------------------------------------------------------------- /misc/crx-config/icon48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unogz/izhihu/HEAD/misc/crx-config/icon48.png -------------------------------------------------------------------------------- /misc/ext-config/icon-48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unogz/izhihu/HEAD/misc/ext-config/icon-48.png -------------------------------------------------------------------------------- /misc/ext-config/icon-64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unogz/izhihu/HEAD/misc/ext-config/icon-64.png -------------------------------------------------------------------------------- /misc/xpi-config/icon64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unogz/izhihu/HEAD/misc/xpi-config/icon64.png -------------------------------------------------------------------------------- /src/pages/README.md: -------------------------------------------------------------------------------- 1 | ## 各个功能模块 2 | 3 | - 必须包含init方法 4 | - 必须把自己注册到izhihu : `this.izhihu.set(module)` -------------------------------------------------------------------------------- /docs/prototype/favorites.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unogz/izhihu/HEAD/docs/prototype/favorites.png -------------------------------------------------------------------------------- /docs/screenshots/功能开关选项_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unogz/izhihu/HEAD/docs/screenshots/功能开关选项_s.png -------------------------------------------------------------------------------- /docs/screenshots/回答目录&预览.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unogz/izhihu/HEAD/docs/screenshots/回答目录&预览.png -------------------------------------------------------------------------------- /docs/screenshots/收藏夹地址清单.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unogz/izhihu/HEAD/docs/screenshots/收藏夹地址清单.png -------------------------------------------------------------------------------- /docs/screenshots/消息通知下拉列表.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unogz/izhihu/HEAD/docs/screenshots/消息通知下拉列表.png -------------------------------------------------------------------------------- /docs/screenshots/用户回答地址清单.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unogz/izhihu/HEAD/docs/screenshots/用户回答地址清单.png -------------------------------------------------------------------------------- /docs/screenshots/首页动态过滤选项.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unogz/izhihu/HEAD/docs/screenshots/首页动态过滤选项.png -------------------------------------------------------------------------------- /misc/ext-config/icon-128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unogz/izhihu/HEAD/misc/ext-config/icon-128.png -------------------------------------------------------------------------------- /docs/screenshots/于回答右侧展开评论列表.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unogz/izhihu/HEAD/docs/screenshots/于回答右侧展开评论列表.png -------------------------------------------------------------------------------- /docs/prototype/assets/comment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unogz/izhihu/HEAD/docs/prototype/assets/comment.png -------------------------------------------------------------------------------- /docs/prototype/assets/favorites.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unogz/izhihu/HEAD/docs/prototype/assets/favorites.png -------------------------------------------------------------------------------- /docs/screenshots/「我要回答」快速跳转链接.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unogz/izhihu/HEAD/docs/screenshots/「我要回答」快速跳转链接.png -------------------------------------------------------------------------------- /docs/screenshots/原有评论框底部添加「收起」按钮.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unogz/izhihu/HEAD/docs/screenshots/原有评论框底部添加「收起」按钮.png -------------------------------------------------------------------------------- /misc/ext-config/Settings.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /dist/README.md: -------------------------------------------------------------------------------- 1 | 发布目录,用于存放打包后的 userscript 或 crx/ext/xpi 源码 2 | 3 | - `izhihu.js` 脚本主体 4 | - `izhihu.userscript.js` 油猴脚本 5 | - `iZhihu for Chrome` Chrome 扩展目录 6 | - `iZhihu for Firefox` Firefox 扩展目录 7 | - `iZhihu.safariextension` Safari 扩展目录 8 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | {"name":"izhihu","version":"2.13.1","buildNum":"532","license":"MIT","devDependencies":{"grunt":"*","grunt-contrib-concat":"*","grunt-contrib-uglify":"*","grunt-contrib-watch":"*","grunt-contrib-copy":"*","grunt-contrib-clean":"*","grunt-string-replace":"*"}} -------------------------------------------------------------------------------- /grunt/README.md: -------------------------------------------------------------------------------- 1 | 这个目录用于存放 Grunt 的配置文件,及各种任务 2 | 3 | # 当前任务 4 | 5 | ## grunt chrome 6 | 7 | 为 Chrome 扩展合并代码并移动到 iZhihu for Chrome 8 | 9 | ## grunt watch 10 | 11 | 监听 src 中 js 文件变化,如果有变化执行 grunt chrome 12 | 13 | ## grunt buildnum 14 | 15 | build 编号自增 1 -------------------------------------------------------------------------------- /misc/xpi-config/test/test-main.js: -------------------------------------------------------------------------------- 1 | var main = require("./main"); 2 | 3 | exports["test main"] = function(assert) { 4 | assert.pass("Unit test running!"); 5 | }; 6 | 7 | exports["test main async"] = function(assert, done) { 8 | assert.pass("async Unit test running!"); 9 | done(); 10 | }; 11 | 12 | require("sdk/test").run(exports); 13 | -------------------------------------------------------------------------------- /docs/.gitCfg.bat: -------------------------------------------------------------------------------- 1 | :: Git Config http://zengrong.net/post/1249.htm && https://github.com/nvie/gitflow/ 2 | git config --global core.quotepath false 3 | git config --global gui.encoding utf-8 4 | git config --global i18n.commitencoding utf-8 5 | git config --global i18n.logoutputencoding gbk 6 | setx LESSCHARSET "utf-8" -m 7 | git config --list 8 | pause 9 | git log -3 10 | cmd -------------------------------------------------------------------------------- /src/begin.js: -------------------------------------------------------------------------------- 1 | var version='2.13.1'; 2 | var updateDate='2015-12-2'; 3 | 4 | if ( typeof unsafeWindow === "undefined") { 5 | unsafeWindow = ( function () { 6 | var dummyElem = document.createElement('p'); 7 | dummyElem.onclick=function(){return window;}; 8 | return dummyElem.onclick (); 9 | } ) (); 10 | } 11 | 12 | //主入口 13 | //$(function main(){ 14 | 15 | -------------------------------------------------------------------------------- /misc/xpi-config/lib/main.js: -------------------------------------------------------------------------------- 1 | var data = require("sdk/self").data; 2 | var pageMod = require("sdk/page-mod"); 3 | pageMod.PageMod({ 4 | include: "*.zhihu.com", 5 | contentStyleFile: data.url("blue.css"), 6 | contentScriptWhen: 'ready', 7 | contentScriptFile: [data.url("jquery-1.8.2.min.js"),data.url("jquery-ui.min.js"),data.url("icheck.min.js"),data.url("purl.js"),data.url("underscore-min.js"),data.url("izhihu.js")] 8 | }); 9 | -------------------------------------------------------------------------------- /test/answer_shift.css: -------------------------------------------------------------------------------- 1 | #zh-single-question .zm-item-answer { 2 | left:0; 3 | right:0; 4 | -webkit-transition:.2s .2s; 5 | transition:.2s .2s; 6 | min-height:auto 7 | } 8 | 9 | #zh-single-question .zm-item-answer:hover { 10 | left:-250px; 11 | min-height: 300px 12 | } 13 | 14 | #zh-single-question .zm-comment-box { 15 | position:absolute!important; 16 | top:-5px; 17 | bottom:-5px; 18 | overflow:auto; 19 | left: 600px; 20 | width: 400px!important; 21 | z-index:9 22 | } 23 | -------------------------------------------------------------------------------- /misc/xpi-config/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name":"izhihu", 3 | "title":"iZhihu", 4 | "id":"jid1-Q3Oc7rhwyTCWhA@jetpack", 5 | "description":"知乎插件", 6 | "author":"钢盅郭子", 7 | "license":"MPL 2.0", 8 | "permissions":{ 9 | "cross-domain-content":[ 10 | "http://*.zhihu.com/", 11 | "http://ilovezhihu.duapp.com/" 12 | ] 13 | }, 14 | "main": "lib/main.js", 15 | "engines": { 16 | "firefox": ">=38.0a1", 17 | "fennec": ">=38.0a1" 18 | }, 19 | "keywords": [ 20 | "jetpack" 21 | ], 22 | "homepage":"http://zhuanlan.zhihu.com/izhihu" 23 | } -------------------------------------------------------------------------------- /Gruntfile.js: -------------------------------------------------------------------------------- 1 | // 安装 node.js 2 | // 安装 grunt - 在控制台( window 运行 cmd)输入 npm install -g grunt-cli 即可 3 | // 项目目录 npm install 安装关联库 4 | // grunt 执行相关任务 (在目录下) 5 | 6 | // 定义 grunt 的设置 7 | module.exports = function (grunt) { 8 | 9 | // 根据 package.json 获取 NpmTasks 并 loadNpmTasks 所用用到了什么常用 任务在 package.json 配置即可 10 | var npmTaskNames = JSON.stringify(grunt.file.readJSON('package.json').devDependencies).match(/grunt\-[^"^']+/g) 11 | , i = npmTaskNames.length; 12 | 13 | while (i--) { 14 | grunt.loadNpmTasks(npmTaskNames[i]); 15 | } 16 | 17 | // 引入配置 与 任务 18 | require('./grunt/config.js')(grunt); 19 | 20 | return grunt; 21 | }; -------------------------------------------------------------------------------- /misc/crx-config/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "manifest_version":2, 3 | "converted_from_user_script":true, 4 | "name":"iZhihu", 5 | "description":"", 6 | "permissions":[ 7 | "http://*.zhihu.com/", 8 | "https://*.zhihu.com/", 9 | "http://ilovezhihu.duapp.com/" 10 | ], 11 | "content_scripts":[ 12 | { 13 | "run_at":"document_end", 14 | "exclude_globs":[], 15 | "include_globs":["*"], 16 | "matches":["http://www.zhihu.com/*","https://www.zhihu.com/*"], 17 | "css": ["blue.css"], 18 | "js":["jquery-1.8.2.min.js","jquery-ui.min.js","icheck.min.js","purl.js","underscore-min.js","izhihu.js"] 19 | } 20 | ], 21 | "web_accessible_resources": ["/*.png","/*.css","*.js"] 22 | } -------------------------------------------------------------------------------- /dist/iZhihu for Chrome.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN PRIVATE KEY----- 2 | MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBANtsf4R5gTiDVfVxA 3 | 0wvPP0VbnNuzq2M+FE7x4VMkO60qLOq4zJgQk9V4OT5WtIpkOLJJqpYMETNeutj8Y 4 | ciWO2RiHdAEe2CxcaEODjycqiw1cnw01XknIZ75GGAa/qFZmOHoJ32ags0kzcCH+Q 5 | O9w2dDaoSqGQ9M/HvW7Fa31sxAgMBAAECgYAWglvWeCx0Yqy3v/8pmpL0F3W8K7rR 6 | /OsgUjSWjRM1GZ1QyRADg/JpdxLaCmZxtsfhK+dmhCN3e2jHqvoE9dYPYDk33a4lk 7 | +GOvSemxjgxo466M25iJJql6MKaE6o8jStfWFEEkQ+44EGd/zWyvUT/PYkMog5Prp 8 | 02Rz7Gq87YwQJBAPea6OsPJTXbRA3VMOacFKsfzgZIjLgk7DZngtf1W7TrXz39mRX 9 | zxoA+sv814lMiUxANVUuIuNE5zwpQLAmp6zkCQQDi3P0RROoc5O006l07b+y3SzjM 10 | GGo+wLF7zlNIE03YNpvQE8XuMn3SlWQvP69LqZrPtA3VhPe7wUoizktNRFe5AkEA2 11 | kOw7HxmVcpafEMhHzgZNBwONhXADhdmLjMi8RH1bE9Lns6tIt/IbIZYrYYnYxdP10 12 | eZl8MHAFCQRMwVddNWaQJBANzRu+aGTNbJIfbitNM485HKP0Ox9CCW0Wsv/rJmT9x 13 | H80wLIxrivMQwM68l7wvXz9+iY+DUp4py7yWH5ZYVEskCQAR4f7zRONvakoX8oMZt 14 | n7ECSBfJpN2gh5UHF5bhb5XWpCNSOjm5eQNA0lcU4+R1ZfR1pH/ZC/gVhW/ZqPzsb 15 | ps= 16 | -----END PRIVATE KEY----- 17 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT LICENSE 2 | 3 | Copyright (c) 2012 https://github.com/unogz/izhihu 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | 25 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Linux 2 | # backup files 3 | *~ 4 | 5 | # Windows 6 | # thumbnails 7 | Thumbs.db 8 | 9 | # Mac OS X 10 | # metadata 11 | .DS_Store 12 | # thumbnails 13 | ._* 14 | 15 | # Visual Studio PHP 16 | *.sln 17 | *.phpproj 18 | *.puo 19 | *.suo 20 | *.cache 21 | 22 | # Netbeans 23 | nbproject/ 24 | catalog.xml 25 | nbactions.xml 26 | 27 | # Eclipse 28 | .settings/ 29 | .buildpath 30 | .classpath 31 | .project 32 | 33 | # SVN 34 | # svn folders 35 | .svn/ 36 | 37 | # PHPStorm 38 | .idea/ 39 | .nameencodings 40 | .xmlmisc 41 | .xmlmodules 42 | .xmlprojectCodeStyle 43 | .xmlvcs.xml 44 | *.imlworkspace 45 | .xml 46 | 47 | 48 | # common # 49 | *.log 50 | logs/ 51 | tmp/ 52 | temp/ 53 | 54 | # nodejs # 55 | node_modules/ 56 | public/gen 57 | sea-modules/ 58 | dist/*.js 59 | 60 | # java # 61 | /plugin.xml 62 | web-app/WEB-INF/classes/ 63 | .settings/ 64 | target/ 65 | target-eclipse/ 66 | grails-*.zip 67 | *.war 68 | .link_to_grails_plugins/ 69 | 70 | # other # 71 | *.swp 72 | .DS_Store 73 | 74 | 75 | 76 | /.gitCfg.bat 77 | /iZhihu for Chrome/ 78 | 79 | # develop files 80 | build/ 81 | dist/iZhihu for Chrome/ 82 | 83 | #picasa 84 | .picasa.ini 85 | /dist/iZhihu for Firefox 86 | /dist/iZhihu.safariextension 87 | 88 | dist/ 89 | -------------------------------------------------------------------------------- /src/end.js: -------------------------------------------------------------------------------- 1 | var firstRun = parseInt(utils.getValue('izh_fr','1')); 2 | 3 | function _FRshow(){ 4 | if(firstRun>0 && document.domain=='zhihu.com'){ 5 | var tboxleft=0; 6 | var accitem1= $('#zh-top-inner div.top-nav-profile .zu-top-nav-userinfo'); 7 | if(accitem1.length>0){ 8 | tboxleft = accitem1.offset().left; 9 | } 10 | if(tboxleft>0){ 11 | $('
', { id: 'iZhihu_tbox', 'class': 't_frshow' }).appendTo('body.zhi').hide() 12 | .append($('
', { 'class': 't_txtshow t_tbox' }) 13 | .append('感谢使用') 14 | .append($('').text('iZhihu')) 15 | .append($('
')) 16 | .append('您可通过菜单【iZhihu】对功能进行设置') 17 | .append($('
')) 18 | .append($('') 19 | .append($('')) 20 | ) 21 | ); 22 | $('#iZhihu_tbox').css('left',tboxleft-100).show().mouseenter(function(){ 23 | utils.setValue('izh_fr','0'); 24 | //_Menu(); 25 | $(this).remove(); 26 | }); 27 | } 28 | } 29 | } 30 | 31 | setTimeout(function(){ 32 | _FRshow(); 33 | },1000); 34 | 35 | 36 | console.log('iZhihu '+version+' started.'); 37 | //console.log(window.iZhihu); 38 | //console.log((new Date()).getTime()); 39 | //}); 40 | -------------------------------------------------------------------------------- /src/meta.js: -------------------------------------------------------------------------------- 1 | // ==UserScript== 2 | // @name iZhihu 3 | // @namespace https://github.com/unogz/izhihu 4 | // @version 2.13.1 5 | // @description 知乎插件 6 | // @match http://www.zhihu.com/* 7 | // @include http://www.zhihu.com/* 8 | // @match https://www.zhihu.com/* 9 | // @include https://www.zhihu.com/* 10 | // @require http://cdn.staticfile.org/jquery/1.8.2/jquery.min.js 11 | // @require http://cdn.staticfile.org/iCheck/1.0.1/icheck.min.js 12 | // @resource jqUI_CSS http://cdn.staticfile.org/iCheck/1.0.1/skins/square/blue.css 13 | // @resource ui-bg_icheck-skin_square_blue http://cdn.staticfile.org/iCheck/1.0.1/skins/square/blue.png 14 | // @resource ui-bg_icheck-skin_square_blue2x http://cdn.staticfile.org/iCheck/1.0.1/skins/square/blue@2x.png 15 | // @require http://cdn.staticfile.org/jqueryui/1.10.4/jquery-ui.min.js 16 | // @require http://cdn.staticfile.org/purl/2.3.1/purl.min.js 17 | // @require http://cdn.staticfile.org/underscore.js/1.6.0/underscore-min.js 18 | // @grant GM_xmlHttpRequest 19 | // @grant GM_addStyle 20 | // @grant GM_getResourceText 21 | // @grant GM_getResourceURL 22 | // @icon https://raw.githubusercontent.com/unogz/izhihu/develop/misc/xpi-config/icon64.png 23 | // @copyright 2015+, @钢盅郭子 @刘勇 @墨磊 24 | // ==/UserScript== 25 | 26 | var jqUI_CssSrc = GM_getResourceText("jqUI_CSS") 27 | , imgURL = GM_getResourceURL('ui-bg_icheck-skin_square_blue') 28 | , imgURL2x = GM_getResourceURL('ui-bg_icheck-skin_square_blue2x') 29 | GM_addStyle (jqUI_CssSrc.replace('blue.png', imgURL).replace('blue@2x.png', imgURL2x)); 30 | -------------------------------------------------------------------------------- /docs/prototype/favorites.bmml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | %u6DFB%u52A0%u300C%u6536%u85CF%u95EE%u9898%u300D%u529F%u80FD%uFF0C%u4FDD%u5B58%u5230cloudfoundry%u7684mongodb%u53BB%u3002 6 | 7 | 8 | 9 | 10 | %u589E%u52A0%u300C%u6295%u9012%u6536%u85CF%u5939%u300D%u529F%u80FD%uFF0C%u53EF%u4EE5%u641C%u7D22%u70ED%u95E8%u7684%u6536%u85CF%u5939%uFF0C%u81EA%u52A8%u751F%u6210%u8BC4%u8BBA%u5185%u5BB9%uFF0C%u5E76%u8BC4%u8BBA%u3002 11 | 12 | 13 | 14 | 15 | 16750848 16 | bottom 17 | true 18 | false 19 | 20 | 21 | 22 | 23 | ./assets/favorites.png 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /misc/ext-config/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Builder Version 6 | 9537.76.4 7 | CFBundleDisplayName 8 | iZhihu - 我爱知乎 9 | CFBundleIdentifier 10 | com.unogz.izhihu 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleShortVersionString 14 | [version] 15 | CFBundleVersion 16 | 1 17 | Chrome 18 | 19 | Content 20 | 21 | Scripts 22 | 23 | Start 24 | 25 | jquery-1.8.2.min.js 26 | jquery-ui.min.js 27 | icheck.min.js 28 | purl.js 29 | underscore-min.js 30 | 31 | End 32 | 33 | izhihu.js 34 | 35 | 36 | Stylesheets 37 | 38 | blue.css 39 | 40 | 41 | ExtensionInfoDictionaryVersion 42 | 1.0 43 | Permissions 44 | 45 | Website Access 46 | 47 | Allowed Domains 48 | 49 | *.zhihu.com 50 | ilovezhihu.duapp.com 51 | 52 | Include Secure Pages 53 | 54 | Level 55 | Some 56 | 57 | 58 | Update Manifest URL 59 | http://izhihu.unogz.com/safari/Info.plist 60 | Website 61 | http://zhuanlan.zhihu.com/izhihu 62 | 63 | 64 | -------------------------------------------------------------------------------- /import/blue.css: -------------------------------------------------------------------------------- 1 | /* iCheck plugin Square skin, blue 2 | ----------------------------------- */ 3 | .icheckbox_square-blue, 4 | .iradio_square-blue { 5 | display: inline-block; 6 | *display: inline; 7 | vertical-align: middle; 8 | margin: 0; 9 | padding: 0; 10 | width: 22px; 11 | height: 22px; 12 | background: url(blue.png) no-repeat; 13 | border: none; 14 | cursor: pointer; 15 | } 16 | 17 | .icheckbox_square-blue { 18 | background-position: 0 0; 19 | } 20 | .icheckbox_square-blue.hover { 21 | background-position: -24px 0; 22 | } 23 | .icheckbox_square-blue.checked { 24 | background-position: -48px 0; 25 | } 26 | .icheckbox_square-blue.disabled { 27 | background-position: -72px 0; 28 | cursor: default; 29 | } 30 | .icheckbox_square-blue.checked.disabled { 31 | background-position: -96px 0; 32 | } 33 | 34 | .iradio_square-blue { 35 | background-position: -120px 0; 36 | } 37 | .iradio_square-blue.hover { 38 | background-position: -144px 0; 39 | } 40 | .iradio_square-blue.checked { 41 | background-position: -168px 0; 42 | } 43 | .iradio_square-blue.disabled { 44 | background-position: -192px 0; 45 | cursor: default; 46 | } 47 | .iradio_square-blue.checked.disabled { 48 | background-position: -216px 0; 49 | } 50 | 51 | /* Retina support */ 52 | @media only screen and (-webkit-min-device-pixel-ratio: 1.5), 53 | only screen and (-moz-min-device-pixel-ratio: 1.5), 54 | only screen and (-o-min-device-pixel-ratio: 3/2), 55 | only screen and (min-device-pixel-ratio: 1.5) { 56 | .icheckbox_square-blue, 57 | .iradio_square-blue { 58 | background-image: url(blue@2x.png); 59 | -webkit-background-size: 240px 24px; 60 | background-size: 240px 24px; 61 | } 62 | } -------------------------------------------------------------------------------- /src/pages/collection.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 收藏页 3 | */ 4 | if(pageIs.Collection){ 5 | //添加按钮 6 | $('#zh-list-meta-wrap') 7 | .append($('', { 'class': 'zg-bull' }).text('•')) 8 | .append($('', { href: 'javascript:;', id: 'getAllLinks' }).text('地址清单')); 9 | 10 | var btn = $('#getAllLinks'); 11 | var result = []; 12 | 13 | //注册点击事件 14 | btn.click(function(){ 15 | var allLinksCollection=new allLinks('Collections','#zh-list-answer-wrap','收藏夹内容'); 16 | if(!allLinksCollection.initDialog())return; 17 | $('.modal-dialog-bg').show(); 18 | var y = ($win.height() - allLinksCollection.$dlg.width()) / 2 19 | , x = ($win.width() - allLinksCollection.$dlg.width()) / 2 20 | ; 21 | allLinksCollection.$dlg.css({'top': y, 'left': x}).fadeIn('slow'); 22 | allLinksCollection.start(); 23 | }); 24 | } 25 | if(pageIs.Answers){ 26 | //添加按钮 27 | $('.zm-profile-section-name') 28 | .append($('', { 'class': 'zg-bull' }).text('•')) 29 | .append($('', { href: 'javascript:;', id: 'getAllLinks' }).text('地址清单')); 30 | 31 | var btn = $('#getAllLinks'); 32 | var result = []; 33 | 34 | //注册点击事件 35 | btn.click(function(){ 36 | var allLinksAnswers=new allLinks('Answers','#zh-profile-answer-list','用户回答'); 37 | if(!allLinksAnswers.initDialog())return; 38 | $('.modal-dialog-bg').show(); 39 | var y = ($win.height() - allLinksAnswers.$dlg.width()) / 2 40 | , x = ($win.width() - allLinksAnswers.$dlg.width()) / 2 41 | ; 42 | allLinksAnswers.$dlg.css({'top': y, 'left': x}).fadeIn('slow'); 43 | allLinksAnswers.start(); 44 | }); 45 | } 46 | 47 | if(pageIs.MyCollection&&window.iZhihu.QuickFavo){ 48 | var $favItems=$('#zh-favlists-wrap').children('.zm-item'); 49 | $favItems.each(function(i,e){ 50 | }); 51 | } 52 | -------------------------------------------------------------------------------- /src/pages/answer.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 回答页 3 | */ 4 | 5 | if(pageIs.Answer){ 6 | 7 | var $lblQuestionMeta=$('#zh-question-meta-wrap')//question_meta 8 | ; 9 | 10 | var $questionWrap=$('#zh-question-meta-wrap'); 11 | $questionWrap.children('.panel-container').bind('DOMNodeInserted',function(event){ 12 | window.iZhihu.Comment.processComment($(event.target)); 13 | }); 14 | if(window.iZhihu.Comment.RightComment){ 15 | //$questionWrap.children('.meta-item[name=addcomment]').prependTo($questionWrap); 16 | window.iZhihu.Comment.processCommentButton($questionWrap); 17 | if(!$('#izh_QuestionShadow').length){ 18 | $('
',{'class':'izh_boxShadow',id:'izh_QuestionShadow'}).css({ 19 | 'z-index': '-1' 20 | , 'position': 'relative' 21 | , 'top': -25 22 | , 'margin-left': -32 23 | }).prependTo('body>.zu-main:first').hide(); 24 | } 25 | } 26 | 27 | //process each answer 28 | var $listAnswers=$('.zm-item-answer,.feed-item','#zh-question-answer-wrap'); 29 | if($listAnswers&&$listAnswers.length){ 30 | $listAnswers.each(function(i,e){ 31 | window.iZhihu.Answer.processAnswer($(e),null 32 | , izhAuthorRear 33 | , false); 34 | }); 35 | } 36 | 37 | $('#zh-question-answer-wrap').bind('DOMNodeInserted',function(event){ 38 | var $na=$(event.target).filter('.zm-item-answer'); 39 | if($na.length){ 40 | window.iZhihu.Answer.processAnswer($na,null 41 | , izhAuthorRear 42 | , false); 43 | } 44 | }); 45 | 46 | var $cm=$('.zm-comment-box',$questionWrap); 47 | if($cm.length && $cm.is(':visible')){ 48 | var focusName = iZhihu.Comment.scrollFocusCommentOnPageLoad($cm); 49 | 50 | iZhihu.Comment.metaScrollToViewBottom($cm.closest('.zm-item-meta'),function(){ 51 | iZhihu.Comment.processComment($cm, focusName); 52 | }); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/modules/SearchingList.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @class SearchingList 3 | */ 4 | function SearchingList(iZhihu) { 5 | if ( typeof iZhihu === 'undefined' || !iZhihu) { 6 | return null 7 | } 8 | iZhihu.SearchingList = this 9 | 10 | this.$topSearch = $('#zh-top-search-form') 11 | this.$topSearchInput = $('#zh-top-search-form > input#q') 12 | if (!this.$topSearch.length) return 13 | 14 | this.SearchEngineOutsideList = { 15 | 'google': {icon:'https://www.google.com/favicon.ico',url:'https://www.google.com/?q=site:zhihu.com%20{0}#q=site:zhihu.com+{0}'} 16 | , 'baidu': {icon:'http://www.baidu.com/favicon.ico',url:'http://www.baidu.com/s?wd=site:zhihu.com%20{0}'} 17 | } 18 | 19 | utils.observeDOMNodeAdded(this.$topSearch[0],function(event){ 20 | var _a = event.addedNodes || [] 21 | if (!_a.length) return 22 | utils.observeDOMNodeAdded(_a[0],function(event){console.log(iZhihu.config['SearchEngineOutside']) 23 | var _a = event.addedNodes || [null] 24 | , $item = $(_a[0]) 25 | , seoKey = iZhihu.config['SearchEngineOutside'] || 'baidu' 26 | , seo = iZhihu.SearchingList.SearchEngineOutsideList[seoKey] || {icon:'',url:''} 27 | , strSearchUrl = seo.url.replace(/\{0\}/g, function(){return iZhihu.SearchingList.$topSearchInput.val()}) 28 | console.log(seoKey) 29 | if ($item.is('.ac-row[role=option]')){ 30 | var $a = $item.children('a') 31 | , href = $a.attr('href') 32 | , css = 'float:right;background-position:-284px -2px;' 33 | , $aNew = $('', {class:'zg-icon',style:css,href:href,target:'_blank',click:function(event){ 34 | event.stopPropagation() 35 | }}) 36 | if (href.indexOf('/search?') === 0) { 37 | $aNew.css({marginTop:'0.5em'}) 38 | $item.append($('', {class:'icon',style:'margin-top:0.5em;float:left',href:strSearchUrl,target:'_blank',click:function(event){ 39 | event.stopPropagation() 40 | }}).append($('', {border:0,src:seo.icon,width:16,height:16}))) 41 | } else if (href.indexOf('/question/') < 0) { 42 | $aNew.css({marginTop:'-1.5em'}) 43 | } 44 | $item.append($aNew) 45 | } 46 | }) 47 | }) 48 | 49 | return this 50 | } 51 | -------------------------------------------------------------------------------- /src/modules/TopNav.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @class TopNav 3 | */ 4 | function TopNav(iZhihu) { 5 | if ( typeof iZhihu === 'undefined' || !iZhihu || !iZhihu.config['TopNavAutoFold']) { 6 | return null 7 | } 8 | iZhihu.TopNav = this 9 | 10 | this.$topNav = $('body > .zu-top:first') 11 | .on('mouseover', function(event){ 12 | this.style.top = '0' 13 | this.setAttribute('izh-mouseover', '1') 14 | $('#izhCSS_NotiNum').remove() 15 | }) 16 | .on('mouseout', function(event){ 17 | this.setAttribute('izh-mouseover', '0') 18 | iZhihu.TopNav.funcFold() 19 | }) 20 | if (!this.$topNav.length) return 21 | 22 | this.topNavHeight = this.$topNav.height() - 5 23 | 24 | this.funcFold = function(event){ 25 | var scrollTop = document.documentElement.scrollTop || document.body.scrollTop || 0 26 | , _self = iZhihu.TopNav 27 | , isMouseOver = '1' === (_self.$topNav.attr('izh-mouseover') || '') 28 | , $head = $('head:first') 29 | , $cssNotiNum = $('#izhCSS_NotiNum') 30 | , $floatingBar = $('body > .goog-scrollfloater-floating') 31 | if (scrollTop === 0) { 32 | _self.$topNav.css({top:0}) 33 | } else if (!isMouseOver) { 34 | if (scrollTop < _self.topNavHeight) { 35 | _self.$topNav.css({top:-scrollTop}) 36 | $floatingBar.css({marginTop:-scrollTop}) 37 | } else { 38 | _self.$topNav.css({top:-_self.topNavHeight}) 39 | $floatingBar.css({marginTop:-_self.topNavHeight}) 40 | } 41 | if (scrollTop > 20) { 42 | if (!$cssNotiNum.length) { 43 | $('