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);
});
}
$(function(){
- tracker = document.createElement('div');
- tracker.id = 'tracker';
- tracker.className = 'hidden';
- tracker.innerHTML = 'Tracking <a id="tracker_userlink"></a>.<br><a id="tracker_stop" role="button">Stop tracking</a><br><a id="tracker_log">Job log</a><dl class="dl-horizontal"><dt>Solved</dt> <dd id="tracker_solved">?</dd><dt>Attempted</dt> <dd id="tracker_attempted">?</dd><dt>Contests</dt> <dd id="tracker_contests">?</dd></dl>';
+ tracker = m('<div id="tracker" class="hidden">Tracking <a id="tracker_userlink"></a>.<br><a id="tracker_stop" role="button">Stop tracking</a><br><a id="tracker_log">Job log</a><dl class="dl-horizontal"><dt>Solved</dt> <dd id="tracker_solved">?</dd><dt>Attempted</dt> <dd id="tracker_attempted">?</dd><dt>Contests</dt> <dd id="tracker_contests">?</dd></dl></div>');
var sidebar = $('#sidebar')[0];
sidebar.insertBefore(tracker, sidebar.firstChild);
$('#tracker_stop').on('click', stop_tracking);