/themes/kit/js/kit/jquery.kit-source.js
JavaScript | 21 lines | 15 code | 0 blank | 6 comment | 0 complexity | d181dffe9534d926f6867f25de36dbc1 MD5 | raw file
Possible License(s): BSD-3-Clause, MIT, AGPL-1.0
- /*global jQuery */
- /*!
- * Lettering.JS 0.6.1
- *
- * Crawl the elements page and show example source code
- */
- (function($){
- $('article.element .markup').wrap('<div class="example">');
- $('article.element .markup').each(function(){
- var thisHTML = $(this).html().replace('</textarea>', '</textarea>');
- $(this).after('<div class="show-source"><div class="show-hide">show source</div><textarea class="show-source-textarea">'+ thisHTML +'</textarea></div>');
- $(this).find('+ .show-source textarea.show-source-textarea').height($(this).height()).css('min-height', '100px').hide();
- $(this).find('+ .show-source .show-hide').toggle(function(){
- $(this).html('hide source');
- $(this).find('+ textarea.show-source-textarea').slideDown();
- }, function(){
- $(this).html('show source');
- $(this).find('+ textarea.show-source-textarea').slideUp();
- });
- });
- })(jQuery);