Created
August 8, 2013 00:54
-
-
Save chitacan/6180477 to your computer and use it in GitHub Desktop.
chardin.js chrome devtools snippet.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
if ( !window.jQuery ) { | |
var s = document.createElement('script'); | |
s.setAttribute('src', '//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js'); | |
document.body.appendChild(s); | |
console.log('jquery loaded!'); | |
} | |
if ( !window.jQuery.fn.chardinJs ) { | |
var head = document.getElementsByTagName('head')[0]; | |
var l = document.createElement('link'); | |
l.setAttribute('rel', 'stylesheet'); | |
l.setAttribute('type', 'text/css'); | |
l.setAttribute('href', 'https://rawgithub.com/heelhook/chardin.js/master/chardinjs.css') | |
head.appendChild(l); | |
var s = document.createElement('script'); | |
s.setAttribute('src', 'https://rawgithub.com/heelhook/chardin.js/master/chardinjs.js'); | |
head.appendChild(s); | |
console.log("OK, Don't forget to add 'data-intro', 'data-position' target element.") | |
} | |
// TODO : convert to jQuery plugin | |
window.chardify = function($el, intro, position) { | |
$el.attr('data-intro', intro); | |
$el.attr('data-position', position); | |
} | |
window.dechardify = function($el) { | |
$el.attr('data-intro', ''); | |
$el.attr('data-position', ''); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment