]> iEval git - gruntmaster-page.git/blob - js/90-custom.js
Fix a bug in is_problem_in_contest
[gruntmaster-page.git] / js / 90-custom.js
1 (function(){
2 'use strict';
3 function set_style(name){
4 $('#stylesheet').attr("href", "/css/" + name + ".css");
5 localStorage.setItem("theme", name);
6 if(name == 'slate' || name == 'cyborg')
7 $('.logo').addClass('logo-dark');
8 else
9 $('.logo').removeClass('logo-dark');
10 }
11
12 var theme = localStorage.getItem("theme");
13 if(theme) {
14 set_style(theme);
15 }
16
17 $( document ).ready(function() {
18 var hiddenDiv = $(document.createElement('div'));
19
20 hiddenDiv.addClass('hiddendiv common');
21
22 $('body').append(hiddenDiv);
23
24 $("textarea.autoresize").on('keyup', function () {
25 var content = $(this).val();
26
27 content = content.replace(/\n/g, '<br>');
28 hiddenDiv.html(content + '<br class="lbr">');
29
30 $(this).css('height', hiddenDiv.height()+23);
31 });
32
33 $('#theme_slate' ).on('click', function () { set_style("slate"); });
34 $('#theme_cerulean').on('click', function () { set_style("cerulean"); });
35 $('#theme_cyborg' ).on('click', function () { set_style("cyborg"); });
36 $('#theme_cosmo' ).on('click', function () { set_style("cosmo"); });
37
38 if(!$('#sidebar').size()) {
39 var content = $('#content');
40 content.wrapInner('<div class="col-md-9">').append('<div id="sidebar" class="col-md-3">').addClass('row');
41 }
42 $('#sponsors').detach().appendTo($('#sidebar'));
43
44 if(theme) set_style(theme);
45 });
46 })();
This page took 0.054744 seconds and 4 git commands to generate.