summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorMichael Walker <mike@barrucadu.co.uk>2014-09-28 22:39:20 +0000
committerMichael Walker <mike@barrucadu.co.uk>2014-09-28 23:06:18 +0000
commit7c7a465966ea66d2b5ebbcf6567e7b04cbd3f9f2 (patch)
treecb082c23cb916c50eadc8f8052c5dc8c6b3c7bf9 /templates
parentd60fd4abf3ad5f6686713f19cf106b8ba9080609 (diff)
Implement syntax highlighting
Diffstat (limited to 'templates')
-rw-r--r--templates/header.html1
-rw-r--r--templates/main.js22
2 files changed, 21 insertions, 2 deletions
diff --git a/templates/header.html b/templates/header.html
index dd15eeb8..06bc95d9 100644
--- a/templates/header.html
+++ b/templates/header.html
@@ -4,6 +4,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=yes">
{% if config.meta_keywords %}<meta name="keywords" content="{{ config.meta_keywords }}">{% endif %}
{% if config.default_stylesheet.1 != '' %}<link rel="stylesheet" type="text/css" id="stylesheet" href="{{ config.uri_stylesheets }}{{ config.default_stylesheet.1 }}">{% endif %}
+ {% if config.default_code_stylesheet.1 != '' %}<link rel="stylesheet" type="text/css" id="code_stylesheet" href="{{ config.uri_stylesheets }}{{ config.default_code_stylesheet.1 }}">{% endif %}
{% if config.font_awesome %}<link rel="stylesheet" href="{{ config.root }}{{ config.font_awesome_css }}">{% endif %}
{% if config.country_flags_condensed %}<link rel="stylesheet" href="{{ config.root }}{{ config.country_flags_condensed_css }}">{% endif %}
<script type="text/javascript">
diff --git a/templates/main.js b/templates/main.js
index 97f1135f..6ad999ba 100644
--- a/templates/main.js
+++ b/templates/main.js
@@ -31,6 +31,11 @@ var styles = {
{% for stylesheet in stylesheets %}{% raw %}'{% endraw %}{{ stylesheet.name|addslashes }}{% raw %}' : '{% endraw %}{{ stylesheet.uri|addslashes }}{% raw %}',
{% endraw %}{% endfor %}{% raw %}
};
+var codestyles = {
+ {% endraw %}
+ {% for stylesheet in code_stylesheets %}{% raw %}'{% endraw %}{{ stylesheet.name|addslashes }}{% raw %}' : '{% endraw %}{{ stylesheet.uri|addslashes }}{% raw %}',
+ {% endraw %}{% endfor %}{% raw %}
+};
var board_name = false;
function changeStyle(styleName, link) {
@@ -45,6 +50,7 @@ function changeStyle(styleName, link) {
{% endif %}
{% raw %}
+ // Main stylesheet
if (!document.getElementById('stylesheet')) {
var s = document.createElement('link');
s.rel = 'stylesheet';
@@ -53,9 +59,21 @@ function changeStyle(styleName, link) {
var x = document.getElementsByTagName('head')[0];
x.appendChild(s);
}
-
+
document.getElementById('stylesheet').href = styles[styleName];
- selectedstyle = styleName;
+ selectedstyle = styleName;
+
+ // Code stylesheet
+ if (!document.getElementById('code_stylesheet')) {
+ var s = document.createElement('link');
+ s.rel = 'stylesheet';
+ s.type = 'text/css';
+ s.id = 'code_stylesheet';
+ var x = document.getElementsByTagName('head')[0];
+ x.appendChild(s);
+ }
+
+ document.getElementById('code_stylesheet').href = codestyles[styleName];
if (document.getElementsByClassName('styles').length != 0) {
var styleLinks = document.getElementsByClassName('styles')[0].childNodes;