Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 
 

43 rindas
948 B

  1. (function(){
  2. var $button = $("<div id='source-button' class='btn btn-primary btn-xs'>&lt; &gt;</div>").click(function(){
  3. var html = $(this).parent().html();
  4. html = cleanSource(html);
  5. $("#source-modal pre").text(html);
  6. $("#source-modal").modal();
  7. });
  8. $('.bs-component [data-toggle="popover"]').popover();
  9. $('.bs-component [data-toggle="tooltip"]').tooltip();
  10. $(".bs-component").hover(function(){
  11. $(this).append($button);
  12. $button.show();
  13. }, function(){
  14. $button.hide();
  15. });
  16. function cleanSource(html) {
  17. var lines = html.split(/\n/);
  18. lines.shift();
  19. lines.splice(-1, 1);
  20. var indentSize = lines[0].length - lines[0].trim().length,
  21. re = new RegExp(" {" + indentSize + "}");
  22. lines = lines.map(function(line){
  23. if (line.match(re)) {
  24. line = line.substring(indentSize);
  25. }
  26. return line;
  27. });
  28. lines = lines.join("\n");
  29. return lines;
  30. }
  31. })();