Browse Source

TOC styling

Create default TOC style with options to use the theme css
pull/686/head
danpros 1 year ago
parent
commit
a8e3c0e670
13 changed files with 113 additions and 375 deletions
  1. +3
    -0
      config/config.ini.example
  2. +1
    -1
      content/data/configList.json
  3. +19
    -0
      system/admin/views/config-widget.html.php
  4. +42
    -6
      system/includes/functions.php
  5. +48
    -0
      system/resources/css/toc.css
  6. +0
    -46
      themes/blog/css/styles.css
  7. +0
    -46
      themes/clean/css/style.css
  8. +0
    -46
      themes/doks/css/style.css
  9. +0
    -46
      themes/logs/css/style.css
  10. +0
    -46
      themes/readable/css/style.css
  11. +0
    -46
      themes/twentyfifteen/css/style.css
  12. +0
    -46
      themes/twentyfifteen/css/style_v2.css
  13. +0
    -46
      themes/twentysixteen/css/style.css

+ 3
- 0
config/config.ini.example View File

@ -141,6 +141,9 @@ toc.label = "Table of Contents"
; TOC inital state ; TOC inital state
toc.state = "close" toc.state = "close"
; TOC style
toc.style = "default"
; Set the theme here ; Set the theme here
views.root = "themes/twentysixteen" views.root = "themes/twentysixteen"


+ 1
- 1
content/data/configList.json View File

@ -1 +1 @@
["site.url","timezone","date.format","language","blog.title","blog.tagline","blog.description","blog.copyright","permalink.type","static.frontpage","blog.enable","social.twitter","social.facebook","breadcrumb.home","comment.system","fb.appid","fb.num","fb.color","disqus.shortname","google.wmt.id","google.analytics.id","google.gtag.id","google.reCaptcha","google.reCaptcha.public","google.reCaptcha.private","posts.perpage","category.perpage","tag.perpage","archive.perpage","search.perpage","profile.perpage","type.perpage","json.count","category.info","related.count","recent.count","popular.count","tagcloud.count","teaser.type","read.more","teaser.char","description.char","rss.count","rss.char","views.counter","sitemap.priority.base","sitemap.priority.post","sitemap.priority.static","sitemap.priority.category","sitemap.priority.tag","sitemap.priority.archiveDay","sitemap.priority.archiveMonth","sitemap.priority.archiveYear","sitemap.priority.author","sitemap.priority.type","prerelease","cache.expiration","cache.off","generation.time","cache.timestamp","multi.site","toc.label","toc.state","views.root","views.layout"]
["site.url","timezone","date.format","language","blog.title","blog.tagline","blog.description","blog.copyright","permalink.type","static.frontpage","blog.enable","social.twitter","social.facebook","breadcrumb.home","comment.system","fb.appid","fb.num","fb.color","disqus.shortname","google.wmt.id","google.analytics.id","google.gtag.id","google.reCaptcha","google.reCaptcha.public","google.reCaptcha.private","posts.perpage","category.perpage","tag.perpage","archive.perpage","search.perpage","profile.perpage","type.perpage","json.count","category.info","related.count","recent.count","popular.count","tagcloud.count","teaser.type","read.more","teaser.char","description.char","rss.count","rss.char","views.counter","sitemap.priority.base","sitemap.priority.post","sitemap.priority.static","sitemap.priority.category","sitemap.priority.tag","sitemap.priority.archiveDay","sitemap.priority.archiveMonth","sitemap.priority.archiveYear","sitemap.priority.author","sitemap.priority.type","prerelease","cache.expiration","cache.off","generation.time","cache.timestamp","multi.site","toc.label","toc.state","toc.style","views.root","views.layout"]

+ 19
- 0
system/admin/views/config-widget.html.php View File

@ -85,6 +85,25 @@
</div> </div>
</div> </div>
</div> </div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">TOC styling</label>
<div class="col-sm-10">
<div class="col-sm-10">
<div class="form-check">
<input class="form-check-input" type="radio" name="-config-toc.style" id="toc.style1" value="default" <?php if (config('toc.style') === 'default'):?>checked<?php endif;?>>
<label class="form-check-label" for="toc.style1">
Default
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="-config-toc.style" id="toc.style2" value="theme" <?php if (config('toc.style') === 'theme'):?>checked<?php endif;?>>
<label class="form-check-label" for="toc.style2">
Theme
</label>
</div>
</div>
</div>
</div>
<br> <br>
<h4><?php echo i18n('Comments');?></h4> <h4><?php echo i18n('Comments');?></h4>
<hr> <hr>


+ 42
- 6
system/includes/functions.php View File

@ -528,6 +528,12 @@ function get_posts($posts, $page = 1, $perpage = 0)
if (empty($label)) { if (empty($label)) {
$label = 'Table of Contents'; $label = 'Table of Contents';
} }
$style = config('toc.style');
if ($style == 'default' || empty($style)) {
$style = '<link rel="stylesheet" id="default-toc-style" href="'. site_url() .'system/resources/css/toc.css" type="text/css" media="all">';
} else {
$style = '';
}
$load = <<<EOF $load = <<<EOF
<script> <script>
document.addEventListener("DOMContentLoaded", function() { document.addEventListener("DOMContentLoaded", function() {
@ -541,7 +547,7 @@ function get_posts($posts, $page = 1, $perpage = 0)
}); });
</script> </script>
EOF; EOF;
$post->body = $toc['0'] . '<div class="toc-wrapper" id="toc-wrapper.post-'.$post->date.'" style="display:none;" >'. $load .'<details '. $state .'><summary title="'. $label .'"><span class="details">'. $label .'</span></summary><div class="inner"><div class="toc" id="toc.post-'.$post->date.'"></div></div></details><script src="'. site_url().'system/resources/js/toc.generator.js"></script></div>' . $toc['1'];
$post->body = $toc['0'] . '<div class="toc-wrapper" id="toc-wrapper.post-'.$post->date.'" style="display:none;" >'. $load . $style .'<details '. $state .'><summary title="'. $label .'"><span class="details">'. $label .'</span></summary><div class="inner"><div class="toc" id="toc.post-'.$post->date.'"></div></div></details><script src="'. site_url().'system/resources/js/toc.generator.js"></script></div>' . $toc['1'];
} }
// Convert image tags to figures // Convert image tags to figures
@ -618,6 +624,12 @@ function get_pages($pages, $page = 1, $perpage = 0)
if (empty($label)) { if (empty($label)) {
$label = 'Table of Contents'; $label = 'Table of Contents';
} }
$style = config('toc.style');
if ($style == 'default' || empty($style)) {
$style = '<link rel="stylesheet" id="default-toc-style" href="'. site_url() .'system/resources/css/toc.css" type="text/css" media="all">';
} else {
$style = '';
}
$load = <<<EOF $load = <<<EOF
<script> <script>
document.addEventListener("DOMContentLoaded", function() { document.addEventListener("DOMContentLoaded", function() {
@ -631,7 +643,7 @@ function get_pages($pages, $page = 1, $perpage = 0)
}); });
</script> </script>
EOF; EOF;
$post->body = $toc['0'] . '<div class="toc-wrapper" id="toc-wrapper.page-'.$post->slug.'" style="display:none;" >'. $load .'<details '. $state .'><summary title="'. $label .'"><span class="details">'. $label .'</span></summary><div class="inner"><div class="toc" id="toc.page-'.$post->slug.'"></div></div></details><script src="'. site_url().'system/resources/js/toc.generator.js"></script></div>' . $toc['1'];
$post->body = $toc['0'] . '<div class="toc-wrapper" id="toc-wrapper.page-'.$post->slug.'" style="display:none;" >'. $load . $style .'<details '. $state .'><summary title="'. $label .'"><span class="details">'. $label .'</span></summary><div class="inner"><div class="toc" id="toc.page-'.$post->slug.'"></div></div></details><script src="'. site_url().'system/resources/js/toc.generator.js"></script></div>' . $toc['1'];
} }
if (config('views.counter') == 'true') { if (config('views.counter') == 'true') {
@ -714,6 +726,12 @@ function get_subpages($sub_pages, $page = 1, $perpage = 0)
if (empty($label)) { if (empty($label)) {
$label = 'Table of Contents'; $label = 'Table of Contents';
} }
$style = config('toc.style');
if ($style == 'default' || empty($style)) {
$style = '<link rel="stylesheet" id="default-toc-style" href="'. site_url() .'system/resources/css/toc.css" type="text/css" media="all">';
} else {
$style = '';
}
$load = <<<EOF $load = <<<EOF
<script> <script>
document.addEventListener("DOMContentLoaded", function() { document.addEventListener("DOMContentLoaded", function() {
@ -727,7 +745,7 @@ function get_subpages($sub_pages, $page = 1, $perpage = 0)
}); });
</script> </script>
EOF; EOF;
$post->body = $toc['0'] . '<div class="toc-wrapper" id="toc-wrapper.subpage-'.$post->slug.'" style="display:none;" >'. $load .'<details '. $state .'><summary title="'. $label .'"><span class="details">'. $label .'</span></summary><div class="inner"><div class="toc" id="toc.subpage-'.$post->slug.'"></div></div></details><script src="'. site_url().'system/resources/js/toc.generator.js"></script></div>' . $toc['1'];
$post->body = $toc['0'] . '<div class="toc-wrapper" id="toc-wrapper.subpage-'.$post->slug.'" style="display:none;" >'. $load . $style .'<details '. $state .'><summary title="'. $label .'"><span class="details">'. $label .'</span></summary><div class="inner"><div class="toc" id="toc.subpage-'.$post->slug.'"></div></div></details><script src="'. site_url().'system/resources/js/toc.generator.js"></script></div>' . $toc['1'];
} }
if (config('views.counter') == 'true') { if (config('views.counter') == 'true') {
@ -1017,6 +1035,12 @@ function read_category_info($category)
if (empty($label)) { if (empty($label)) {
$label = 'Table of Contents'; $label = 'Table of Contents';
} }
$style = config('toc.style');
if ($style == 'default' || empty($style)) {
$style = '<link rel="stylesheet" id="default-toc-style" href="'. site_url() .'system/resources/css/toc.css" type="text/css" media="all">';
} else {
$style = '';
}
$load = <<<EOF $load = <<<EOF
<script> <script>
document.addEventListener("DOMContentLoaded", function() { document.addEventListener("DOMContentLoaded", function() {
@ -1030,7 +1054,7 @@ function read_category_info($category)
}); });
</script> </script>
EOF; EOF;
$desc->body = $toc['0'] . '<div class="toc-wrapper" id="toc-wrapper.taxonomy-'.$desc->slug.'" style="display:none;" >'. $load .'<details '. $state .'><summary title="'. $label .'"><span class="details">'. $label .'</span></summary><div class="inner"><div class="toc" id="toc.taxonomy-'.$desc->slug.'"></div></div></details><script src="'. site_url().'system/resources/js/toc.generator.js"></script></div>' . $toc['1'];
$desc->body = $toc['0'] . '<div class="toc-wrapper" id="toc-wrapper.taxonomy-'.$desc->slug.'" style="display:none;" >'. $load . $style .'<details '. $state .'><summary title="'. $label .'"><span class="details">'. $label .'</span></summary><div class="inner"><div class="toc" id="toc.taxonomy-'.$desc->slug.'"></div></div></details><script src="'. site_url().'system/resources/js/toc.generator.js"></script></div>' . $toc['1'];
} }
$desc->description = get_content_tag("d", $content, get_description($desc->body)); $desc->description = get_content_tag("d", $content, get_description($desc->body));
@ -1270,6 +1294,12 @@ function get_author($name)
if (empty($label)) { if (empty($label)) {
$label = 'Table of Contents'; $label = 'Table of Contents';
} }
$style = config('toc.style');
if ($style == 'default' || empty($style)) {
$style = '<link rel="stylesheet" id="default-toc-style" href="'. site_url() .'system/resources/css/toc.css" type="text/css" media="all">';
} else {
$style = '';
}
$load = <<<EOF $load = <<<EOF
<script> <script>
document.addEventListener("DOMContentLoaded", function() { document.addEventListener("DOMContentLoaded", function() {
@ -1283,7 +1313,7 @@ function get_author($name)
}); });
</script> </script>
EOF; EOF;
$author->about = $toc['0'] . '<div class="toc-wrapper" id="toc-wrapper.profile-'.$author->slug.'" style="display:none;" >'. $load .'<details '. $state .'><summary title="'. $label .'"><span class="details">'. $label .'</span></summary><div class="inner"><div class="toc" id="toc.profile-'.$author->slug.'"></div></div></details><script src="'. site_url().'system/resources/js/toc.generator.js"></script></div>' . $toc['1'];
$author->about = $toc['0'] . '<div class="toc-wrapper" id="toc-wrapper.profile-'.$author->slug.'" style="display:none;" >'. $load . $style .'<details '. $state .'><summary title="'. $label .'"><span class="details">'. $label .'</span></summary><div class="inner"><div class="toc" id="toc.profile-'.$author->slug.'"></div></div></details><script src="'. site_url().'system/resources/js/toc.generator.js"></script></div>' . $toc['1'];
} }
$author->body = $author->about; $author->body = $author->about;
@ -1345,6 +1375,12 @@ function get_frontpage()
if (empty($label)) { if (empty($label)) {
$label = 'Table of Contents'; $label = 'Table of Contents';
} }
$style = config('toc.style');
if ($style == 'default' || empty($style)) {
$style = '<link rel="stylesheet" id="default-toc-style" href="'. site_url() .'system/resources/css/toc.css" type="text/css" media="all">';
} else {
$style = '';
}
$load = <<<EOF $load = <<<EOF
<script> <script>
document.addEventListener("DOMContentLoaded", function() { document.addEventListener("DOMContentLoaded", function() {
@ -1358,7 +1394,7 @@ function get_frontpage()
}); });
</script> </script>
EOF; EOF;
$front->body = $toc['0'] . '<div class="toc-wrapper" id="toc-wrapper.page-front" style="display:none;" >'. $load .'<details '. $state .'><summary title="'. $label .'"><span class="details">'. $label .'</span></summary><div class="inner"><div class="toc" id="toc.page-front"></div></div></details><script src="'. site_url().'system/resources/js/toc.generator.js"></script></div>' . $toc['1'];
$front->body = $toc['0'] . '<div class="toc-wrapper" id="toc-wrapper.page-front" style="display:none;" >'. $load . $style . '<details '. $state .'><summary title="'. $label .'"><span class="details">'. $label .'</span></summary><div class="inner"><div class="toc" id="toc.page-front"></div></div></details><script src="'. site_url().'system/resources/js/toc.generator.js"></script></div>' . $toc['1'];
} }
} else { } else {
$front->title = 'Welcome'; $front->title = 'Welcome';


+ 48
- 0
system/resources/css/toc.css View File

@ -0,0 +1,48 @@
summary {
display: list-item;
cursor: pointer;
}
.toc-wrapper {
background: #f9f9f9;
border: 1px solid #aaa;
border-radius: 4px;
-webkit-box-shadow: 0 1px 1px rgba(0,0,0,.05);
box-shadow: 0 1px 1px rgba(0,0,0,.05);
margin-bottom: 1.5em;
padding: 10px;
position: relative;
width: auto;
font-size: 90%;
}
.toc-wrapper .inner {
margin-top:5px;
}
.toc-wrapper .inner a {
border: none;
box-shadow:none;
}
.toc .h3-toc {
margin-left: .20in;
}
.toc .h4-toc {
margin-left: .35in;
}
.toc .h5-toc {
margin-left: .50in;
}
.toc .h6-toc {
margin-left: .65in;
}
.toc-link a.anchor {
border:none;
margin-left: 5px;
box-shadow:none;
}

+ 0
- 46
themes/blog/css/styles.css View File

@ -629,49 +629,3 @@ ul.month {
margin:0 0 0 10px; margin:0 0 0 10px;
float:right; float:right;
} }
summary {
display: list-item;
cursor: pointer;
}
.toc-wrapper {
background: #f9f9f9;
border: 1px solid #aaa;
border-radius: 4px;
-webkit-box-shadow: 0 1px 1px rgba(0,0,0,.05);
box-shadow: 0 1px 1px rgba(0,0,0,.05);
margin-bottom: 1.5em;
padding: 10px;
position: relative;
width: auto;
font-size: 90%;
}
.toc-wrapper .inner {
margin-top:5px;
}
.toc-wrapper .inner a {
border: none;
box-shadow:none;
}
.toc .h3-toc {
margin-left: .20in;
}
.toc .h4-toc {
margin-left: .35in;
}
.toc .h5-toc {
margin-left: .50in;
}
.toc .h6-toc {
margin-left: .65in;
}
.toc-link a.anchor {
border:none;
margin-left: 5px;
box-shadow:none;
}

+ 0
- 46
themes/clean/css/style.css View File

@ -950,49 +950,3 @@ ul.archivegroup {
list-style: none; list-style: none;
background:none; background:none;
} }
summary {
display: list-item;
cursor: pointer;
}
.toc-wrapper {
background: #f9f9f9;
border: 1px solid #aaa;
border-radius: 4px;
-webkit-box-shadow: 0 1px 1px rgba(0,0,0,.05);
box-shadow: 0 1px 1px rgba(0,0,0,.05);
margin-bottom: 1.5em;
padding: 10px;
position: relative;
width: auto;
font-size: 90%;
}
.toc-wrapper .inner {
margin-top:5px;
}
.toc-wrapper .inner a {
border: none;
box-shadow:none;
}
.toc .h3-toc {
margin-left: .20in;
}
.toc .h4-toc {
margin-left: .35in;
}
.toc .h5-toc {
margin-left: .50in;
}
.toc .h6-toc {
margin-left: .65in;
}
.toc-link a.anchor {
border:none;
margin-left: 5px;
box-shadow:none;
}

+ 0
- 46
themes/doks/css/style.css View File

@ -3533,49 +3533,3 @@ body.dark .docs-bar .menu-icon .navicon::before, body.dark .docs-bar .menu-icon
.float-right { .float-right {
float:right; float:right;
} }
summary {
display: list-item;
cursor: pointer;
}
.toc-wrapper {
background: #f9f9f9;
border: 1px solid #aaa;
border-radius: 4px;
-webkit-box-shadow: 0 1px 1px rgba(0,0,0,.05);
box-shadow: 0 1px 1px rgba(0,0,0,.05);
margin-bottom: 1.5em;
padding: 10px;
position: relative;
width: auto;
font-size: 90%;
}
.toc-wrapper .inner {
margin-top:5px;
}
.toc-wrapper .inner a {
border: none;
box-shadow:none;
}
.toc .h3-toc {
margin-left: .20in;
}
.toc .h4-toc {
margin-left: .35in;
}
.toc .h5-toc {
margin-left: .50in;
}
.toc .h6-toc {
margin-left: .65in;
}
.toc-link a.anchor {
border:none;
margin-left: 5px;
box-shadow:none;
}

+ 0
- 46
themes/logs/css/style.css View File

@ -980,49 +980,3 @@ ul.archivegroup {
.archivegroup li.expanded, .archivegroup li.collapsed { .archivegroup li.expanded, .archivegroup li.collapsed {
list-style: none; list-style: none;
} }
summary {
display: list-item;
cursor: pointer;
}
.toc-wrapper {
background: #f9f9f9;
border: 1px solid #aaa;
border-radius: 4px;
-webkit-box-shadow: 0 1px 1px rgba(0,0,0,.05);
box-shadow: 0 1px 1px rgba(0,0,0,.05);
margin-bottom: 1.5em;
padding: 10px;
position: relative;
width: auto;
font-size: 90%;
}
.toc-wrapper .inner {
margin-top:5px;
}
.toc-wrapper .inner a {
border: none;
box-shadow:none;
}
.toc .h3-toc {
margin-left: .20in;
}
.toc .h4-toc {
margin-left: .35in;
}
.toc .h5-toc {
margin-left: .50in;
}
.toc .h6-toc {
margin-left: .65in;
}
.toc-link a.anchor {
border:none;
margin-left: 5px;
box-shadow:none;
}

+ 0
- 46
themes/readable/css/style.css View File

@ -1031,49 +1031,3 @@ ul.archivegroup {
.archivegroup li.expanded, .archivegroup li.collapsed { .archivegroup li.expanded, .archivegroup li.collapsed {
list-style: none; list-style: none;
} }
summary {
display: list-item;
cursor: pointer;
}
.toc-wrapper {
background: #f9f9f9;
border: 1px solid #aaa;
border-radius: 4px;
-webkit-box-shadow: 0 1px 1px rgba(0,0,0,.05);
box-shadow: 0 1px 1px rgba(0,0,0,.05);
margin-bottom: 1.5em;
padding: 10px;
position: relative;
width: auto;
font-size: 90%;
}
.toc-wrapper .inner {
margin-top:5px;
}
.toc-wrapper .inner a {
border: none;
box-shadow:none;
}
.toc .h3-toc {
margin-left: .20in;
}
.toc .h4-toc {
margin-left: .35in;
}
.toc .h5-toc {
margin-left: .50in;
}
.toc .h6-toc {
margin-left: .65in;
}
.toc-link a.anchor {
border:none;
margin-left: 5px;
box-shadow:none;
}

+ 0
- 46
themes/twentyfifteen/css/style.css View File

@ -6140,49 +6140,3 @@ ul.month {
.feed-link a { .feed-link a {
height:100%; height:100%;
} }
summary {
display: list-item;
cursor: pointer;
}
.toc-wrapper {
background: #f9f9f9;
border: 1px solid #aaa;
border-radius: 4px;
-webkit-box-shadow: 0 1px 1px rgba(0,0,0,.05);
box-shadow: 0 1px 1px rgba(0,0,0,.05);
margin-bottom: 1.5em;
padding: 10px;
position: relative;
width: auto;
font-size: 90%;
}
.toc-wrapper .inner {
margin-top:5px;
}
.toc-wrapper .inner a {
border: none;
box-shadow:none;
}
.toc .h3-toc {
margin-left: .20in;
}
.toc .h4-toc {
margin-left: .35in;
}
.toc .h5-toc {
margin-left: .50in;
}
.toc .h6-toc {
margin-left: .65in;
}
.toc-link a.anchor {
border:none;
margin-left: 5px;
box-shadow:none;
}

+ 0
- 46
themes/twentyfifteen/css/style_v2.css View File

@ -6147,49 +6147,3 @@ ul.month {
.feed-link a { .feed-link a {
height:100%; height:100%;
} }
summary {
display: list-item;
cursor: pointer;
}
.toc-wrapper {
background: #f9f9f9;
border: 1px solid #aaa;
border-radius: 4px;
-webkit-box-shadow: 0 1px 1px rgba(0,0,0,.05);
box-shadow: 0 1px 1px rgba(0,0,0,.05);
margin-bottom: 1.5em;
padding: 10px;
position: relative;
width: auto;
font-size: 90%;
}
.toc-wrapper .inner {
margin-top:5px;
}
.toc-wrapper .inner a {
border: none;
box-shadow:none;
}
.toc .h3-toc {
margin-left: .20in;
}
.toc .h4-toc {
margin-left: .35in;
}
.toc .h5-toc {
margin-left: .50in;
}
.toc .h6-toc {
margin-left: .65in;
}
.toc-link a.anchor {
border:none;
margin-left: 5px;
box-shadow:none;
}

+ 0
- 46
themes/twentysixteen/css/style.css View File

@ -4066,49 +4066,3 @@ ul.month {
margin:0 0 0 10px; margin:0 0 0 10px;
float:right; float:right;
} }
summary {
display: list-item;
cursor: pointer;
}
.toc-wrapper {
background: #f9f9f9;
border: 1px solid #aaa;
border-radius: 4px;
-webkit-box-shadow: 0 1px 1px rgba(0,0,0,.05);
box-shadow: 0 1px 1px rgba(0,0,0,.05);
margin-bottom: 1.5em;
padding: 10px;
position: relative;
width: auto;
font-size: 90%;
}
.toc-wrapper .inner {
margin-top:5px;
}
.toc-wrapper .inner a {
border: none;
box-shadow:none;
}
.toc .h3-toc {
margin-left: .20in;
}
.toc .h4-toc {
margin-left: .35in;
}
.toc .h5-toc {
margin-left: .50in;
}
.toc .h6-toc {
margin-left: .65in;
}
.toc-link a.anchor {
border:none;
margin-left: 5px;
box-shadow:none;
}

Loading…
Cancel
Save