├── tool.rar ├── tool ├── icon.png ├── content_script.js ├── background.js └── manifest.json └── readme.md /tool.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lchiffon/cosxReviewTool/master/tool.rar -------------------------------------------------------------------------------- /tool/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lchiffon/cosxReviewTool/master/tool/icon.png -------------------------------------------------------------------------------- /tool/content_script.js: -------------------------------------------------------------------------------- 1 | console.log(1) 2 | var f = document.querySelector('#diff-0 > div.file-header > div.file-info > a').title.trim().replace(/.*\/|\.md$/g, '').replace(/^([0-9]{4})-([0-9]{2})-([0-9]{2})-(.*)$/g, '$1/$2/$4') 3 | var i = location.pathname.replace(/^.*pull\/|\/files.*/g, '') 4 | window.open('https://deploy-preview-' + i + '--cosx.netlify.com/' + f) 5 | -------------------------------------------------------------------------------- /tool/background.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | function updateIcon() { 5 | chrome.tabs.executeScript(null, {file: "content_script.js"}); 6 | } 7 | 8 | chrome.browserAction.onClicked.addListener(updateIcon); 9 | updateIcon(); 10 | -------------------------------------------------------------------------------- /tool/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Cosx review工具", 3 | "description": "自动跳转到预览页面", 4 | "version": "1.0", 5 | "permissions": [ 6 | "tabs", "http://*/*", "https://*/*" 7 | ], 8 | "background": { "scripts": ["background.js"] }, 9 | "browser_action": { 10 | "default_title": "Set this page's color.", 11 | "default_icon": "icon.png" 12 | }, 13 | "manifest_version": 2 14 | } 15 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | 2 | # Chrome Extention 3 | 4 | cos主站review工具, 可以用来快速打开已经生成好的页面 5 | 6 | 1. 首先, 你需要一个chrome 7 | 1. 从这里下载扩展工具, 并且自己解压: [扩展工具](https://github.com/Lchiffon/cosxReviewTool/raw/master/tool.rar) 8 | 1. 打开浏览器的扩展管理 9 | 1. 点击开发者模式(Developermode) 10 | 1. 点击加载未打包的应用(Load unpacked extensions) 11 | 1. 好了, 去[某个PR的file页面上](https://github.com/cosname/cosx.org/pull/390/files)点击右上角工具栏的那个小风车就可以了~ 12 | 13 | 14 | ![image](https://cloud.githubusercontent.com/assets/7221728/25038817/29c91b00-2133-11e7-8b1f-d1b3b40e5007.png) 15 | 16 | ![image](https://cloud.githubusercontent.com/assets/7221728/25038839/4526859a-2133-11e7-948d-b35733f546c7.png) 17 | 18 | ![image](https://cloud.githubusercontent.com/assets/7221728/25038851/5c17333a-2133-11e7-8169-2d3be6387d64.png) 19 | 20 | ![image](https://cloud.githubusercontent.com/assets/7221728/25038878/724a46a6-2133-11e7-9482-9342a837220a.png) 21 | --------------------------------------------------------------------------------