mirror of
https://github.com/kennethreitz-archive/.com.git
synced 2026-06-21 15:51:00 +00:00
31 lines
732 B
HTML
31 lines
732 B
HTML
<script type="text/javascript" charset="utf-8">
|
|
jQuery(function($){
|
|
function underscore(str) {
|
|
return str.replace(/::/g, '/')
|
|
.replace(/([A-Z]+)([A-Z][a-z])/g, '$1_$2')
|
|
.replace(/([a-z\d])([A-Z])/g, '$1_$2')
|
|
.replace(/-/g, '_')
|
|
.toLowerCase();
|
|
}
|
|
|
|
function dasherize(str) {
|
|
return underscore(str).replace(/_/g, '-');
|
|
}
|
|
|
|
$("h1").each(function(){
|
|
var name = $(this).text();
|
|
$(this).attr("id", "h-" + dasherize(name));
|
|
});
|
|
|
|
$("h2").each(function(){
|
|
var name = $(this).text();
|
|
$(this).attr("id", "s-" + dasherize(name));
|
|
});
|
|
});
|
|
|
|
jQuery(function(){
|
|
|
|
$("pre").wrapInner('<code>')
|
|
});
|
|
|
|
</script> |