JSFiddle - React, Tailwind, and code Playground
by Cody Lindley
HTML
<script src="https://dl.dropboxusercontent.com/u/2026291/jshint-2.1.10.js"></script>
<h3>hinting:</h3>
<p><a href="https://raw.github.com/ejci/favico.js/master/favico.js">https://raw.github.com/ejci/favico.js/master/favico.js</a></p>
<br>
<small>results show below:</small>
<hr>
<div></div>
<pre><code>
/**
* @fileOverview Favico animations
* @author Miroslav Magda, http://blog.ejci.net
* @version 0.2.1
*/
/**
* Create new favico instance
* @param {Object} Options
* @return {Object} Favico object
* @example
* var favico = new Favico({
* bgColor : '#d00',
* textColor : '#fff',
* type : 'circle',
* animation : 'slide',
* });
*/
var Favico = (function(opt) {'use strict';
opt = (opt) ? opt : {};
var _def = {
bgColor : '#d00',
textColor : '#fff',
type : 'circle',
animation : 'slide',
elementId : false
};
var _opt, _orig, _h, _w, _canvas, _context, _img, _ready, _lastBadge, _running, _readyCb, _stop, _browser;
var _queue = [];
_readyCb = function() {
};
_ready = _stop = false;
/**
* Initialize favico
*/
var init = function() {
//merge initial options
_opt = merge(_def, opt);
_opt.bgColor = hexToRgb(_opt.bgColor);
_opt.textColor = hexToRgb(_opt.textColor);
_opt.animation = (animation.types['' + _opt.animation]) ? _opt.animation : _def.animation;
_opt.type = (type['' + _opt.type]) ? _opt.type : _def.type;
try {
_orig = link.getIcon();
//create temp canvas
_canvas = document.createElement('canvas');
//create temp image
_img = document.createElement('img');
_img.setAttribute('src', _orig.getAttribute('href'));
//get width/height
_img.onload = function() {
_h = (_img.height > 0) ? _img.height : 32;
_w = (_img.width > 0) ? _img.width : 32;
_canvas.height = _h;
...
CSS
pre{
display:none;
}
p, h3{
display: inline;
}
JavaScript
JSHINT(jQuery('code').text());
var errors = [];
JSHINT.data().errors.forEach(function(e){
errors.push('line '+e.line+' - '+e.reason+'<br>');
});
jQuery('div').append(errors.join(''));