mirror of
https://github.com/klaussilveira/gitlist.git
synced 2025-11-17 19:20:56 +01:00
Added simple theming system
This commit is contained in:
43
themes/bootstrap3/js/main.js
Executable file
43
themes/bootstrap3/js/main.js
Executable file
@@ -0,0 +1,43 @@
|
||||
$(function () {
|
||||
$('.dropdown-toggle').dropdown();
|
||||
|
||||
if ($('#sourcecode').length) {
|
||||
var value = $('#sourcecode').text();
|
||||
var mode = $('#sourcecode').attr('language');
|
||||
var pre = $('#sourcecode').get(0);
|
||||
var viewer = CodeMirror(function(elt) {
|
||||
pre.parentNode.replaceChild(elt, pre);
|
||||
}, {
|
||||
value: value,
|
||||
lineNumbers: true,
|
||||
matchBrackets: true,
|
||||
lineWrapping: true,
|
||||
readOnly: true,
|
||||
mode: mode,
|
||||
lineNumberFormatter: function(ln) {
|
||||
return '<a name="L'+ ln +'"></a><a href="#L'+ ln +'">'+ ln +'</a>';
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if ($('#md-content').length) {
|
||||
var converter = new Showdown.converter({extensions: ['table']});
|
||||
$('#md-content').html(converter.makeHtml($('#md-content').text()));
|
||||
}
|
||||
|
||||
function paginate() {
|
||||
var $pager = $('.pager');
|
||||
|
||||
$pager.find('.next a').one('click', function (e) {
|
||||
e.preventDefault();
|
||||
$.get(this.href, function (html) {
|
||||
$pager.after(html);
|
||||
$pager.remove();
|
||||
paginate();
|
||||
});
|
||||
});
|
||||
|
||||
$pager.find('.previous').remove();
|
||||
}
|
||||
paginate();
|
||||
});
|
||||
Reference in New Issue
Block a user