├── CREDITS.txt ├── background.htm ├── icons ├── icon_128.png ├── icon_16.png ├── icon_256.png └── icon_48.png ├── manifest.json ├── LICENSE ├── readme.rdoc ├── cssreloader.content.js ├── cssreloader.background.js ├── keys.css ├── options.htm └── cssreloader.options.js /CREDITS.txt: -------------------------------------------------------------------------------- 1 | ICON by: http://www.everaldo.com/crystal/?action=preview -------------------------------------------------------------------------------- /background.htm: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /icons/icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rstacruz/css-reloader-chrome/master/icons/icon_128.png -------------------------------------------------------------------------------- /icons/icon_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rstacruz/css-reloader-chrome/master/icons/icon_16.png -------------------------------------------------------------------------------- /icons/icon_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rstacruz/css-reloader-chrome/master/icons/icon_256.png -------------------------------------------------------------------------------- /icons/icon_48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rstacruz/css-reloader-chrome/master/icons/icon_48.png -------------------------------------------------------------------------------- /manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "manifest_version": 2, 3 | "name": "CSS Reloader", 4 | "version": "1.1.4", 5 | "description": "CSS Reloader is a browser extension, that allows you to reload CSS without reloading the page itself.", 6 | 7 | "options_page" : "options.htm", 8 | "background": { 9 | "page": "background.htm" 10 | }, 11 | "permissions": [ 12 | "http://*/*", "https://*/*", 13 | "contextMenus", "tabs" 14 | ], 15 | "icons": { 16 | "16": "icons/icon_16.png", 17 | "48": "icons/icon_48.png", 18 | "128": "icons/icon_128.png", 19 | "256": "icons/icon_256.png" 20 | }, 21 | "content_scripts": [ 22 | { 23 | "matches": ["http://*/*", "https://*/*"], 24 | "js": ["cssreloader.content.js"] 25 | } 26 | ] 27 | } 28 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 Kenneth Auchenberg 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | -------------------------------------------------------------------------------- /readme.rdoc: -------------------------------------------------------------------------------- 1 | = CSS Reloader 2 | 3 | CSS Reloader is a browser extension that allows you to reload CSS without reloading the page itself. 4 | 5 | It's currently available for Mozilla Firefox and Google Chrome, 6 | 7 | == Usage 8 | 9 | You can reload all stylesheets via the keyboard shortcut F9, or via the context-menu's option "Reload CSS". 10 | 11 | You are able to customize the keyboard shortcut under the extensions settings page. 12 | 13 | == Installation 14 | 15 | === Google Chrome 16 | Grab the latests version for Chrome at https://chrome.google.com/extensions/detail/dnfpcpfijpdhabaoieccoclghgplmpbd 17 | 18 | == Limitations 19 | 20 | CSS Reloader isn't reloading stylesheets references by @import (Been looking into this, and there's not easy solution.) 21 | 22 | == Feedback 23 | 24 | Feel free to report issues on GitHub! It's much needed! 25 | 26 | * View Source on GitHub (http://github.com/auchenberg/css-reloader-chrome) 27 | * Report Issues on GitHub (http://github.com/auchenberg/css-reloader-chrome/issues) 28 | 29 | == Copyright 30 | 31 | Copyright (c) 2014, Kenneth Auchenberg. See LICENSE for details. -------------------------------------------------------------------------------- /cssreloader.content.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | 3 | var shortcutSettings; 4 | 5 | function initialize() { 6 | document.addEventListener("keydown", onWindowKeyDown, false); 7 | chrome.extension.onRequest.addListener(onExtensionRequest); 8 | chrome.extension.sendRequest({'action' : 'getSettings'}, onGetSettings); 9 | } 10 | 11 | function reload() { 12 | var elements = document.querySelectorAll('link[rel=stylesheet][href]'); 13 | for (var i = 0, element; element = elements[i]; i++) { 14 | var href = element.href.replace(/[?&]cssReloader=([^&$]*)/,''); 15 | element.href = href + (href.indexOf('?')>=0?'&':'?') + 'cssReloader=' + (new Date().valueOf()); 16 | } 17 | } 18 | 19 | function onGetSettings(settings) { 20 | shortcutSettings = settings; 21 | } 22 | 23 | function onWindowKeyDown(e) { 24 | if(e.keyIdentifier == shortcutSettings["keyIdentifier"] && 25 | e.shiftKey === shortcutSettings["shiftKeySelected"] && 26 | e.altKey === shortcutSettings["altKeySelected"] && 27 | e.ctrlKey === shortcutSettings["controlKeySelected"]) 28 | { 29 | reload(); 30 | } 31 | } 32 | 33 | function onExtensionRequest(request, sender) { 34 | if (request.action == "reload") { 35 | reload(); 36 | } 37 | } 38 | 39 | CSSreloader = { 40 | reload : reload, 41 | initialize: initialize 42 | }; 43 | 44 | CSSreloader.initialize(); 45 | 46 | })(); 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /cssreloader.background.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | 3 | var storageKey = "shortcutOptions"; 4 | var defaultShortcutOptions = { 5 | "keyIdentifier" : 'F9', 6 | "altKeySelected" : false, 7 | "controlKeySelected" : false, 8 | "shiftKeySelected" : false 9 | }; 10 | 11 | function initialize() { 12 | chrome.contextMenus.create({"title": "Reload CSS", "type": "normal", "onclick": onContextMenuClicked}); 13 | chrome.extension.onRequest.addListener(onExtensionRequest); 14 | } 15 | 16 | function onExtensionRequest(request, sender, callback) { 17 | 18 | if (request.action == 'getSettings') { 19 | callback(getSettings()); 20 | } 21 | 22 | if (request.action == 'saveSettings') { 23 | saveSettings(request.data); 24 | } 25 | 26 | } 27 | 28 | function onContextMenuClicked(info, tab) { 29 | chrome.tabs.sendRequest(tab.id, {action: "reload"}); 30 | } 31 | 32 | function saveSettings(settings) { 33 | if(settings) { 34 | localStorage[storageKey] = JSON.stringify(settings); 35 | } 36 | } 37 | 38 | function getSettings() { 39 | var storedObject = localStorage[storageKey]; 40 | var settings; 41 | 42 | if(storedObject) { 43 | settings = JSON.parse(storedObject); 44 | } else { 45 | // Going for default settings 46 | settings = defaultShortcutOptions; 47 | saveSettings(settings); 48 | } 49 | 50 | return settings; 51 | } 52 | 53 | initialize(); 54 | 55 | })(); 56 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /keys.css: -------------------------------------------------------------------------------- 1 | /** 2 | * KEYS.css 3 | * 4 | * A simple stylesheet for rendering beautiful keyboard-style elements. 5 | * 6 | * Author: Michael Hüneburg 7 | * Website: http://michaelhue.com/keyscss 8 | * License: MIT License (see LICENSE.txt) 9 | */ 10 | 11 | /* Base style, essential for every key. */ 12 | kbd, .key { 13 | display: inline; 14 | display: inline-block; 15 | min-width: 1em; 16 | padding: .2em .3em; 17 | font: normal .85em/1 "Lucida Grande", Lucida, Arial, sans-serif; 18 | text-align: center; 19 | text-decoration: none; 20 | -moz-border-radius: .3em; 21 | -webkit-border-radius: .3em; 22 | border-radius: .3em; 23 | border: none; 24 | cursor: default; 25 | -moz-user-select: none; 26 | -webkit-user-select: none; 27 | user-select: none; 28 | } 29 | kbd[title], .key[title] { 30 | cursor: help; 31 | } 32 | 33 | /* Dark style for display on light background. This is the default style. */ 34 | kbd, kbd.dark, .dark-keys kbd, .key, .key.dark, .dark-keys .key { 35 | background: rgb(80, 80, 80); 36 | background: -moz-linear-gradient(top, rgb(60, 60, 60), rgb(80, 80, 80)); 37 | background: -webkit-gradient(linear, left top, left bottom, from(rgb(60, 60, 60)), to(rgb(80, 80, 80))); 38 | color: rgb(250, 250, 250); 39 | text-shadow: -1px -1px 0 rgb(70, 70, 70); 40 | -moz-box-shadow: inset 0 0 1px rgb(150, 150, 150), inset 0 -.05em .4em rgb(80, 80, 80), 0 .1em 0 rgb(30, 30, 30), 0 .1em .1em rgba(0, 0, 0, .3); 41 | -webkit-box-shadow: inset 0 0 1px rgb(150, 150, 150), inset 0 -.05em .4em rgb(80, 80, 80), 0 .1em 0 rgb(30, 30, 30), 0 .1em .1em rgba(0, 0, 0, .3); 42 | box-shadow: inset 0 0 1px rgb(150, 150, 150), inset 0 -.05em .4em rgb(80, 80, 80), 0 .1em 0 rgb(30, 30, 30), 0 .1em .1em rgba(0, 0, 0, .3); 43 | } 44 | 45 | /* Light style for display on dark background. */ 46 | kbd.light, .light-keys kbd, .key.light, .light-keys .key { 47 | background: rgb(250, 250, 250); 48 | background: -moz-linear-gradient(top, rgb(210, 210, 210), rgb(255, 255, 255)); 49 | background: -webkit-gradient(linear, left top, left bottom, from(rgb(210, 210, 210)), to(rgb(255, 255, 255))); 50 | color: rgb(50, 50, 50); 51 | text-shadow: 0 0 2px rgb(255, 255, 255); 52 | -moz-box-shadow: inset 0 0 1px rgb(255, 255, 255), inset 0 0 .4em rgb(200, 200, 200), 0 .1em 0 rgb(130, 130, 130), 0 .11em 0 rgba(0, 0, 0, .4), 0 .1em .11em rgba(0, 0, 0, .9); 53 | -webkit-box-shadow: inset 0 0 1px rgb(255, 255, 255), inset 0 0 .4em rgb(200, 200, 200), 0 .1em 0 rgb(130, 130, 130), 0 .11em 0 rgba(0, 0, 0, .4), 0 .1em .11em rgba(0, 0, 0, .9); 54 | box-shadow: inset 0 0 1px rgb(255, 255, 255), inset 0 0 .4em rgb(200, 200, 200), 0 .1em 0 rgb(130, 130, 130), 0 .11em 0 rgba(0, 0, 0, .4), 0 .1em .11em rgba(0, 0, 0, .9); 55 | } -------------------------------------------------------------------------------- /options.htm: -------------------------------------------------------------------------------- 1 | 2 |