├── github-logo.png
├── jquery-logo.png
├── wordpress-logo.png
├── browser-support.png
├── oleschmitt-logo.png
├── opensource-logo.png
├── stackoverflow-logo.png
├── README.md
├── fb-colorize.js
├── bootstrap-logo.svg
├── slider.css
├── fb-colorize.css
├── bootstrap-slider.js
├── index.html
└── LICENSE.html
/github-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/download/fb-colorize/HEAD/github-logo.png
--------------------------------------------------------------------------------
/jquery-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/download/fb-colorize/HEAD/jquery-logo.png
--------------------------------------------------------------------------------
/wordpress-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/download/fb-colorize/HEAD/wordpress-logo.png
--------------------------------------------------------------------------------
/browser-support.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/download/fb-colorize/HEAD/browser-support.png
--------------------------------------------------------------------------------
/oleschmitt-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/download/fb-colorize/HEAD/oleschmitt-logo.png
--------------------------------------------------------------------------------
/opensource-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/download/fb-colorize/HEAD/opensource-logo.png
--------------------------------------------------------------------------------
/stackoverflow-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/download/fb-colorize/HEAD/stackoverflow-logo.png
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Facebook Button Colorizer
2 | =========================
3 |
4 | Tool demonstrating the use of SVG filters in modern web browsers.
5 |
6 |
7 |
8 | Copyright 2014 by [Stijn de Witt](http://stijndewitt.com/), some rights reserved.
9 | Licensed under the Creative Commons Attribution 3.0 [license](https://creativecommons.org/licenses/by/3.0/).
10 |
11 | For more information on Facebook Button Colorizer, refer to my blog post, [Change the facebook button color](http://stijndewitt.wordpress.com/2014/02/22/change-the-facebook-button-color/), or try out the [live demo](http://members.chello.nl/~sgm.jansen/facebook-button-colorizer/).
12 |
13 |
--------------------------------------------------------------------------------
/fb-colorize.js:
--------------------------------------------------------------------------------
1 | (function fb_colorize(){
2 | if (window['console']) console.log('fb-colorize: Starting...');
3 |
4 | if (window['console']) console.log('fb-colorize: Activating colorize slider...');
5 | $('#input-fbc-slider').slider().on('slide', function slide(evt) {colorize(this.value);});
6 | if (window['console']) console.log('fb-colorize: Activated colorize slider.');
7 |
8 | if (window['console']) console.log('fb-colorize: Activating colorize presets...');
9 | $('.preset').on('click', function preset() {colorize($(this).find('i')[0].innerHTML);});
10 | if (window['console']) console.log('fb-colorize: Activated colorize presets.');
11 |
12 | if (window['console']) console.log('fb-colorize: Activating colorize filter...');
13 | $('#colorize').on('submit', function filter(evt) {colorize(); return false;});
14 | if (window['console']) console.log('fb-colorize: Activated colorize filter.');
15 |
16 | if (window['console']) console.log('fb-colorize: Activating preview editor...');
17 | $('#preview').on('submit', preview);
18 | if (window['console']) console.log('fb-colorize: Activated preview editor.');
19 |
20 | if (window['console']) console.info('fb-colorize: Started.');
21 |
22 | function colorize(radix) {
23 | if (radix) {
24 | var code = $('#code-fbc-filter')[0];
25 | code.value = '';
30 | $('#input-fbc-slider').slider('setValue', radix);
31 | $('#input-fbc-slider')[0].value = radix;
32 | }
33 | update('#code-fbc-filter', '#container-fbc-filter', 'HTML');
34 | update('#code-fbc-filter', '#paste-fbc-filter', 'TEXT');
35 | }
36 |
37 | function preview(evt){
38 | if (window['console']) console.info('fb-colorize: Updating preview button...');
39 | if (window['FB']) {
40 | delete window.FB;
41 | var old = document.getElementById('facebook-jssdk');
42 | old.parentNode.removeChild(old);
43 | }
44 | update('#code-fb-button', '#container-fb-button', 'HTML');
45 | update('#code-fb-sdk', '#container-fb-sdk', 'HTML');
46 | evt.preventDefault();
47 | }
48 |
49 | function update(src, dst, type) {
50 | if (window['console']) console.log('fb-colorize: Updating ' + dst + '...');
51 | var source = $(src)[0];
52 | var dest = $(dst)[0];
53 | if (dest) {
54 | var idx, text, data = get(source, "TEXT");
55 | if (type == "TEXT") text = get(dest, "TEXT");
56 | if (text && ((idx = text.indexOf('
133 |
137 |
138 |
Paste this code near the facebook button in your site's HTML.
142 |<svg height="0" width="0">
144 | <filter id="fb-filter">
145 | <feColorMatrix type="hueRotate" values="0"/>
146 | </filter>
147 | </svg>
148 | <style>
149 | .fb-like, .fb-send, .fb-share-button {
150 | -webkit-filter: url(#fb-filter);
151 | filter: url(#fb-filter);
152 | }
153 | </style>
154 |
155 | Live preview. Press it to like my blog post about this tool.
160 |
215 |