-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexamples.js
35 lines (32 loc) · 1.08 KB
/
examples.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
$(function() {
'use strict';
$('.bs-example').each(function() {
var source = $('<div></div>').text($(this).html()).html(),
sources = source.split('\n'),
codes = [],
spaces = 0;
try {
$.each(sources, function(i, text) {
if (!$.trim(text)) {
i > 0 && codes.push('');
return;
}
if (!spaces) {
spaces = text.match(/(^\s+)/)[1].length;
}
codes.push(text.substring(spaces));
});
$(this).next().find('code').html(codes.join('\n'));
} catch (e) {
$(this).next().remove();
}
});
$('#i18n').change(function() {
$.getScript('../src/locale/bootstrap-table-' + $(this).val() + '.js', function() {
$('#table-pagination').bootstrapTable('destroy').bootstrapTable();
});
});
$(window).resize(function () {
$('table[data-toggle="table"]').add($('table[id]')).bootstrapTable('resetView');
});
});