localStorage.setItem("theme", name);
}
-var theme_ul;
-
-function add_themelink(theme, text) {
- theme_ul.innerHTML += '<li><a role="button" data-theme="' + theme + '">' + text + '</a>'
-}
-
$(function() {
- theme_ul = document.createElement('ul');
- theme_ul.className = 'list-inline';
- theme_ul.id = 'themes';
- add_themelink('cyborg', 'Black');
- add_themelink('slate', 'Grey');
- add_themelink('readable', 'White');
+ var theme_ul = '<ul class="list-inline" id="themes">' +
+ '<li><a role="button" data-theme="cyborg">Black</a>' +
+ '<li><a role="button" data-theme="slate">Grey</a>' +
+ '<li><a role="button" data-theme="readable">White</a></ul>';
var sidebar = $('#sidebar')[0];
- sidebar.insertBefore(theme_ul, sidebar.firstChild);
+ sidebar.insertBefore(m(theme_ul), sidebar.firstChild);
$('#themes a').on('click', function(e){
set_style(this.dataset.theme);
});