examples.js 823 B

12345678910111213141516171819202122232425
  1. $(function() {
  2. $('.bs-example').each(function() {
  3. var source = $('<div></div>').text($(this).html()).html(),
  4. sources = source.split('\n'),
  5. codes = [],
  6. spaces = 0;
  7. $.each(sources, function(i, text) {
  8. if (!$.trim(text)) {
  9. i > 0 && codes.push('');
  10. return;
  11. }
  12. if (!spaces) {
  13. spaces = text.match(/(^\s+)/)[1].length;
  14. }
  15. codes.push(text.substring(spaces));
  16. });
  17. $(this).next().find('code').html(codes.join('\n'));
  18. });
  19. $('#i18n').change(function() {
  20. $.getScript('../src/locale/bootstrap-table-' + $(this).val() + '.js', function() {
  21. $('#table-pagination').bootstrapTable('destroy').bootstrapTable();
  22. });
  23. });
  24. });