PageRenderTime 44ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/themes/kit/js/kit/jquery.kit-source.js

https://bitbucket.org/allanfreitas/bugitor
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
  1. /*global jQuery */
  2. /*!
  3. * Lettering.JS 0.6.1
  4. *
  5. * Crawl the elements page and show example source code
  6. */
  7. (function($){
  8. $('article.element .markup').wrap('<div class="example">');
  9. $('article.element .markup').each(function(){
  10. var thisHTML = $(this).html().replace('</textarea>', '&lt;/textarea&gt;');
  11. $(this).after('<div class="show-source"><div class="show-hide">show source</div><textarea class="show-source-textarea">'+ thisHTML +'</textarea></div>');
  12. $(this).find('+ .show-source textarea.show-source-textarea').height($(this).height()).css('min-height', '100px').hide();
  13. $(this).find('+ .show-source .show-hide').toggle(function(){
  14. $(this).html('hide source');
  15. $(this).find('+ textarea.show-source-textarea').slideDown();
  16. }, function(){
  17. $(this).html('show source');
  18. $(this).find('+ textarea.show-source-textarea').slideUp();
  19. });
  20. });
  21. })(jQuery);