├── LICENSE ├── README.md ├── facebook-gist.user.js ├── facebook_gist_viewer.png ├── icons ├── 128.png ├── 16.png └── 48.png └── manifest.json /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2017 Sanghyeok Lee 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Facebook Gist Viewer 2 | Sexy github gist viewer on Facebook. 3 | 4 | [Chrome Web Store link](https://chrome.google.com/webstore/detail/facebook-gist-viewer/kdbnedcfcoaoebgpopmlockjgjecggac) 5 | 6 | ![facebook_gist_viewer.png](https://github.com/shlee322/facebook-gist-viewer/blob/master/facebook_gist_viewer.png) 7 | 8 | ## Using Greasemonkey (and their family) 9 | 10 | 1. Install Grasemonkey / Tampermonkey / Scriptish on your browser. 11 | 2. Click [this][userscript] to install on it. 12 | 13 | [userscript]: https://shlee322/facebook-gist-viewer/raw/master/facebook-gist.user.js 14 | 15 | 16 | ## Homepage 17 | https://github.com/shlee322/facebook-gist-viewer 18 | 19 | ## License 20 | MIT License 21 | 22 | ## Owner 23 | Sanghyeok Lee 24 | 25 | ## Thanks to (Contributor) 26 | - nanhee 27 | - Jeungwon An 28 | - Jeong Arm 29 | -------------------------------------------------------------------------------- /facebook-gist.user.js: -------------------------------------------------------------------------------- 1 | // ==UserScript== 2 | // @name Facebook Gist Viewer 3 | // @namespace https://github.com/shlee322/facebook-gist-viewer 4 | // @version 0.1.2 5 | // @description Sexy github gist viewer on Facebook. 6 | // @updateURL https://github.com/shlee322/facebook-gist-viewer/raw/master/facebook-gist.user.js 7 | // @grant GM_xmlhttpRequest 8 | // @include https://www.facebook.com/* 9 | // ==/UserScript== 10 | 11 | (function() { 12 | var GIST_URL_RE = /https:\/\/gist\.github\.com\/[A-Za-z\d](?:[A-Za-z\d]|-(?=[A-Za-z\d])){0,38}\/[\dA-Fa-f]+/g; 13 | var jsonp_id = 0; 14 | 15 | function doAjax(method, url, callback) { 16 | if (window.GM_xmlhttpRequest) { 17 | GM_xmlhttpRequest({ 18 | method: method, 19 | url: url, 20 | onload: callback, 21 | }); 22 | } else { 23 | var xhr = new XMLHttpRequest(); 24 | xhr.onreadystatechange = function() { 25 | if (xhr.readyState !== 4 || xhr.status !== 200) return; 26 | callback(xhr); 27 | }; 28 | xhr.open(method, url, true); 29 | } 30 | } 31 | 32 | function load_gist(url, user_content) { 33 | doAjax('GET', url + '.json', function(xhr) { 34 | var result = JSON.parse(xhr.response); 35 | if(!document.getElementById('_fgv_stylesheet_')) { 36 | var link = document.createElement('link'); 37 | link.id = '_fgv_stylesheet_'; 38 | link.rel = 'stylesheet'; 39 | link.href = result.stylesheet; 40 | document.head.appendChild(link); 41 | } 42 | user_content.innerHTML += '
' + result.div; 43 | }); 44 | } 45 | 46 | function is_exist_gist_div(user_content, gist_url) { 47 | var elements = user_content.getElementsByClassName('_fgv_div_'); 48 | for(var i=0; i'; 62 | load_gist(gist[0], user_content); 63 | } 64 | } 65 | } 66 | 67 | setInterval(function() { 68 | inject_gist(document.getElementsByClassName('userContent')); 69 | }, 300); 70 | })(); 71 | -------------------------------------------------------------------------------- /facebook_gist_viewer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shlee322/facebook-gist-viewer/f7615a2dcaa233d671235f1f3782443be4762688/facebook_gist_viewer.png -------------------------------------------------------------------------------- /icons/128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shlee322/facebook-gist-viewer/f7615a2dcaa233d671235f1f3782443be4762688/icons/128.png -------------------------------------------------------------------------------- /icons/16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shlee322/facebook-gist-viewer/f7615a2dcaa233d671235f1f3782443be4762688/icons/16.png -------------------------------------------------------------------------------- /icons/48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shlee322/facebook-gist-viewer/f7615a2dcaa233d671235f1f3782443be4762688/icons/48.png -------------------------------------------------------------------------------- /manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "manifest_version": 2, 3 | "name": "Facebook Gist Viewer", 4 | "version": "0.1.2", 5 | "description": "Sexy github gist viewer on Facebook.", 6 | "homepage_url": "https://github.com/shlee322/facebook-gist-viewer", 7 | "icons": { 8 | "16": "icons/16.png", 9 | "48": "icons/48.png", 10 | "128": "icons/128.png" 11 | }, 12 | "content_scripts": [ 13 | { 14 | "js": ["facebook-gist.user.js"], 15 | "matches": ["https://www.facebook.com/*"] 16 | } 17 | ], 18 | "permissions": [ 19 | "https://gist.github.com/*" 20 | ] 21 | } 22 | --------------------------------------------------------------------------------