[doc] Externalize further scripts into customscripts.js

Remove unnecessary include disqus.
Remove sample page for tooltips.
Remove support for unused datatable.
Remove support for page.simple_map and page.complex_map
This commit is contained in:
Andreas Dangel
2020-09-20 19:35:22 +02:00
parent ebddad5d26
commit 50dc1dddaf
15 changed files with 90 additions and 281 deletions

View File

@ -23,9 +23,6 @@ company_name: PMD Open Source Project
github_editme_path: pmd/pmd/blob/master/docs/
# if you're using Github, provide the basepath to the branch you've created for reviews, following the sample here. if not, leave this value blank.
disqus_shortname:
# if you're using disqus for comments, add the shortname here. if not, leave this value blank.
host: 127.0.0.1
# the preview server used. Leave as is.

View File

@ -1,16 +0,0 @@
{% if site.disqus_shortname %}
<div id="disqus_thread"></div>
<script type="text/javascript">
/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
var disqus_shortname = '{{site.disqus_shortname}}'; // required: replace example with your forum shortname
/* * * DON'T EDIT BELOW THIS LINE * * */
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
{% endif %}

View File

@ -9,22 +9,22 @@
<link rel="stylesheet" type="text/css" href="assets/fontawesome-free-5.14.0-web/css/all.min.css">
<link rel="stylesheet" type="text/css" href="assets/bootstrap-4.5.2-dist/css/bootstrap.min.css">
<link rel="stylesheet" href="{{ "css/syntax.css" }}">
<link rel="stylesheet" href="{{ "css/modern-business.css" }}">
<link rel="stylesheet" href="{{ "css/customstyles.css" }}">
<link rel="stylesheet" href="{{ "css/theme-blue.css" }}">
<link rel="stylesheet" href="{{ "css/pmd-customstyles.css" }}">
<link rel="stylesheet" type="text/css" href="css/syntax.css">
<link rel="stylesheet" type="text/css" href="css/modern-business.css">
<link rel="stylesheet" type="text/css" href="css/customstyles.css">
<link rel="stylesheet" type="text/css" href="css/theme-blue.css">
<link rel="stylesheet" type="text/css" href="css/pmd-customstyles.css">
<script src="assets/jquery-3.5.1/jquery-3.5.1.min.js"></script>
<script src="assets/anchorjs-4.2.2/anchor.min.js"></script>
<script src="assets/navgoco-0.2.1/src/jquery.navgoco.min.js"></script>
<script src="assets/bootstrap-4.5.2-dist/js/bootstrap.bundle.min.js"></script>
<script src="assets/Simple-Jekyll-Search-1.0.8/dest/jekyll-search.js"></script>
<script src="assets/jekyll-table-of-contents/toc.js"></script>
<script src="js/tabstate.js"></script>
<script src="js/customscripts.js"></script>
<script type="application/javascript" src="assets/jquery-3.5.1/jquery-3.5.1.min.js"></script>
<script type="application/javascript" src="assets/anchorjs-4.2.2/anchor.min.js"></script>
<script type="application/javascript" src="assets/navgoco-0.2.1/src/jquery.navgoco.min.js"></script>
<script type="application/javascript" src="assets/bootstrap-4.5.2-dist/js/bootstrap.bundle.min.js"></script>
<script type="application/javascript" src="assets/Simple-Jekyll-Search-1.0.8/dest/jekyll-search.js"></script>
<script type="application/javascript" src="assets/jekyll-table-of-contents/toc.js"></script>
<script type="application/javascript" src="js/tabstate.js"></script>
<script type="application/javascript" src="js/customscripts.js"></script>
<link rel="shortcut icon" href="{{ "images/favicon.ico" }}" type="image/x-icon">
<link rel="icon" href="{{ "images/favicon.ico" }}" type="image/x-icon">
<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon">
<link rel="icon" href="images/favicon.ico" type="image/x-icon">
<link rel="alternate" type="application/rss+xml" title="{{ site.title }}" href="{{ "/feed.xml" | prepend: site.url }}">
<link rel="alternate" type="application/rss+xml" title="{{ site.title }}" href="feed.xml">

View File

@ -6,26 +6,22 @@
<title>{% if page.homepage == true %} {{site.homepage_title}} {% elsif page.title %}{{ page.title }}{% endif %} | {{ site.site_title }}</title>
<link rel="stylesheet" type="text/css" href="{{ "/assets/fontawesome-free-5.14.0-web/css/all.min.css" | prepend: site.baseurl | prepend: site.url }}">
<link rel="stylesheet" type="text/css" href="{{ "assets/bootstrap-4.5.2-dist/css/bootstrap.min.css" | prepend: site.baseurl | prepend: site.url }}">
<link rel="stylesheet" href="{{ "/css/modern-business.css" | prepend: site.baseurl | prepend: site.url }}">
<link rel="stylesheet" href="{{ "/css/customstyles.css" | prepend: site.baseurl | prepend: site.url }}">
<link rel="stylesheet" href="{{ "/css/theme-green.css" | prepend: site.baseurl | prepend: site.url }}">
<link rel="stylesheet" href="{{ "/css/syntax.css" | prepend: site.baseurl | prepend: site.url }}">
<link rel="stylesheet" href="{{ "/css/printstyles.css" | prepend: site.baseurl }}">
<link rel="stylesheet" type="text/css" href="assets/fontawesome-free-5.14.0-web/css/all.min.css">
<link rel="stylesheet" type="text/css" href="assets/bootstrap-4.5.2-dist/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/modern-business.css">
<link rel="stylesheet" type="text/css" href="css/customstyles.css">
<link rel="stylesheet" type="text/css" href="css/theme-green.css">
<link rel="stylesheet" type="text/css" href="css/syntax.css">
<link rel="stylesheet" type="text/css" href="css/printstyles.css">
<script>
<script type="application/javascript">
Prince.addScriptFunc("datestamp", function() {
return "PDF last generated: {{ site.time | date: '%B %d, %Y' }}";
});
</script>
<script>
Prince.addScriptFunc("guideName", function() {
return "{{site.print_title}} User Guide";
});
</script>

View File

@ -59,12 +59,4 @@
{% endif %}
{% endfor %}
{% endfor %}
<!-- if you aren't using the accordion, uncomment this block:
<p class="external">
<a href="#" id="collapseAll">Collapse All</a> | <a href="#" id="expandAll">Expand All</a>
</p>
-->
</ul>
<!-- this highlights the active parent class in the navgoco sidebar. this is critical so that the parent expands when you're viewing a page. This must appear below the sidebar code above. Otherwise, if placed inside customscripts.js, the script runs before the sidebar code runs and the class never gets inserted.-->
<script>$("li.active").parents('li').toggleClass("active");</script>

View File

@ -1,12 +1,5 @@
<!-- this handles the automatic toc. use ## for subheads to auto-generate the on-page minitoc. if you use html tags, you must supply an ID for the heading element in order for it to appear in the minitoc. -->
<script>
$( document ).ready(function() {
// Handler for .ready() called.
$('#toc').toc({ minimumHeaders: 0, listType: 'ul', showSpeed: 0, headers: 'h2,h3,h4' });
});
</script>
{% comment %}
Note: The content of the div-element is filled by javascript. See customscripts.js.
{% endcomment %}
<div id="toc"></div>

View File

@ -47,21 +47,6 @@
<form class="form-inline my-2 my-lg-0">
<input class="form-control mr-sm-2" type="search" placeholder="{{site.data.strings.search_placeholder_text}}" id="search-input">
<ul id="results-container"></ul>
<script type="text/javascript">
SimpleJekyllSearch.init({
searchInput: document.getElementById('search-input'),
resultsContainer: document.getElementById('results-container'),
json: '{{ "search.json" }}',
searchResultTemplate: '<li><a href="{url}" title="{{page.title | replace: "\'", "\"}}">{title}</a></li>',
noResultsText: '{{site.data.strings.search_no_results_text}}',
limit: 10,
fuzzy: true,
});
$('#results-container').click(function() {
$('#search-input').val('');
$(this).empty();
});
</script>
</form>
</div>
</div>

View File

@ -2,76 +2,6 @@
<html>
<head>
{% include head.html %}
<script>
$(document).ready(function() {
// Initialize navgoco with default options
$("#mysidebar").navgoco({
caretHtml: '',
accordion: true,
openClass: 'active', // open
save: false, // leave false or nav highlighting doesn't work right
cookie: {
name: 'navgoco',
expires: false,
path: '/'
},
slide: {
duration: 400,
easing: 'swing'
}
});
$("#collapseAll").click(function(e) {
e.preventDefault();
$("#mysidebar").navgoco('toggle', false);
});
$("#expandAll").click(function(e) {
e.preventDefault();
$("#mysidebar").navgoco('toggle', true);
});
});
</script>
<script>
$(function () {
$('[data-toggle="tooltip"]').tooltip()
})
</script>
<script>
$(document).ready(function() {
$("#tg-sb-link").click(function(event) {
$("#tg-sb-sidebar").toggle();
$("#tg-sb-content").toggleClass('col-md-9');
$("#tg-sb-content").toggleClass('col-md-12');
$("#tg-sb-icon").toggleClass('fa-toggle-on');
$("#tg-sb-icon").toggleClass('fa-toggle-off');
event.preventDefault();
});
});
</script>
{% if page.datatable == true %}
<!-- Include the standard DataTables bits -->
<link rel="stylesheet" type="text/css" href="//cdn.datatables.net/1.10.13/css/jquery.dataTables.css">
<script type="text/javascript" charset="utf8" src="//cdn.datatables.net/1.10.13/js/jquery.dataTables.js"></script>
<!-- First, this walks through the tables that occur between ...-begin
and ...-end and add the "datatable" class to them.
Then it invokes DataTable's standard initializer
Credit here: http://www.beardedhacker.com/blog/2015/08/28/add-class-attribute-to-markdown-table/
-->
<script>
$(document).ready(function(){
$('div.datatable-begin').nextUntil('div.datatable-end', 'table').addClass('display');
$('table.display').DataTable( {
paging: true,
stateSave: true,
searching: true
});
});
</script>
{% endif %}
</head>
<body>
<!-- Content is offset by the height of the topnav bar. -->

View File

@ -6,28 +6,6 @@ layout: default
<h1 class="post-title-main">{{ page.title }}</h1>
</div>
{% if page.simple_map == true %}
<script>
$(document).ready ( function(){
$('.box{{page.box_number}}').addClass('active');
});
</script>
{% include custom/{{page.map_name}}.html %}
{% elsif page.complex_map == true %}
<script>
$(document).ready ( function(){
$('.modalButton{{page.box_number}}').addClass('active');
});
</script>
{% include custom/{{page.map_name}}.html %}
{% endif %}
<div class="post-content">
{% if page.summary %}
@ -64,8 +42,6 @@ layout: default
{% endif %}
</div>
{% include disqus.html %}
</div>
{{site.data.alerts.hr_shaded}}

View File

@ -32,8 +32,6 @@ layout: default
</article>
{% include disqus.html %}
{{site.data.alerts.hr_shaded}}
{% include footer.html %}

View File

@ -483,9 +483,6 @@ figcaption {
}
table.dataTable thead {
background-color: #444;
}
table td {
hyphens: auto;
}

View File

@ -15,9 +15,9 @@ author: Jeff Jensen <jjensen@apache.org>, Andreas Dangel <andreas.dangel@adangel
{% unless site.output == "pdf" %}
<script src="assets/Shuffle-5.2.3/dist/shuffle.min.js"></script>
<script src="assets/jquery-ui-1.12.1/jquery-ui.min.js"></script>
<script src="js/shuffle.js"></script>
<script type="application/javascript" src="assets/Shuffle-5.2.3/dist/shuffle.min.js"></script>
<script type="application/javascript" src="assets/jquery-ui-1.12.1/jquery-ui.min.js"></script>
<script type="application/javascript" src="js/shuffle.js"></script>
{% endunless %}

View File

@ -21,4 +21,64 @@ $( document ).ready(function() {
*/
anchors.add('h2,h3,h4,h5');
// Initialize navgoco with default options
$("#mysidebar").navgoco({
caretHtml: '',
accordion: true,
openClass: 'active', // open
save: false, // leave false or nav highlighting doesn't work right
cookie: {
name: 'navgoco',
expires: false,
path: '/'
},
slide: {
duration: 400,
easing: 'swing'
}
});
$("#collapseAll").click(function(e) {
e.preventDefault();
$("#mysidebar").navgoco('toggle', false);
});
$("#expandAll").click(function(e) {
e.preventDefault();
$("#mysidebar").navgoco('toggle', true);
});
// This highlights the active parent class in the navgoco sidebar. This is critical so that the parent expands
// when you're viewing a page.
$("li.active").parents('li').toggleClass("active");
// This handles the automatic toc. Use ## for subheads to auto-generate the on-page minitoc.
// If you use html tags, you must supply an ID for the heading element in order for it to appear in the minitoc.
$('#toc').toc({ minimumHeaders: 0, listType: 'ul', showSpeed: 0, headers: 'h2,h3,h4' });
// Initialize jekyll search in topnav.
SimpleJekyllSearch.init({
searchInput: document.getElementById('search-input'),
resultsContainer: document.getElementById('results-container'),
json: 'search.json',
searchResultTemplate: '<li><a href="{url}">{title}</a></li>',
noResultsText: '{{site.data.strings.search_no_results_text}}',
limit: 10,
fuzzy: true,
});
// Make sure to close and empty the search results after clicking one result item.
// This is necessary, if we don't switch the page but only jump to a anchor on the
// same page.
$('#results-container').click(function() {
$('#search-input').val('');
$(this).empty();
});
// Topnav toggle button for displaying/hiding nav sidebar
$("#tg-sb-link").click(function(event) {
$("#tg-sb-sidebar").toggle();
$("#tg-sb-content").toggleClass('col-md-9');
$("#tg-sb-content").toggleClass('col-md-12');
$("#tg-sb-icon").toggleClass('fa-toggle-on');
$("#tg-sb-icon").toggleClass('fa-toggle-off');
event.preventDefault();
});
});

View File

@ -1,80 +0,0 @@
---
layout: none
search: exclude
---
<html>
<head>
<title> Tooltip Demo</title>
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
/*Bootstrap popovers are initialized with the following script. In the options, I'm setting the placement to be on the right, the trigger to be hover rather than click, and to allow HTML from the JSON data source. */
$('[data-toggle="popover"]').popover({
placement : 'right',
trigger: 'hover',
html: true
});
/* Set the location where mydoc_tooltips_source.json is. */
var url = "tooltips.json";
$.get( url, function( data ) {
/* Bootstrap popover text is defined inside a data-content attribute inside an element. That's
why I'm using attr here. If you just want to insert content on the page, use append and remove the data-content argument from the parentheses.*/
$.each(data.entries, function(i, page) {
if (page.doc_id == "basketball") {
$( "#basketball" ).attr( "data-content", page.body );
}
if (page.doc_id == "baseball") {
$( "#baseball" ).attr( "data-content", page.body );
}
if (page.doc_id == "football") {
$( "#football" ).attr( "data-content", page.body );
}
if (page.doc_id == "soccer") {
$( "#soccer" ).attr( "data-content", page.body );
}
});
});
});
</script>
<style>
body {padding-left:50px;}
</style>
</head>
<body>
<h1>Tooltip Demo</h1>
<p>This page is purposely separated out from the rest of theme so you can see the bare minimum code to add to a page, without all the other theme's code getting in the way.</p>
<p>Content in the tooltips (actually "popovers" according to Bootstrap lingo) can be pulled in dynamically by placing the JSON file on a remote host. </p>
<div class="alert alert-info" role="alert"><b>Note:</b> Make sure you view the file source so you can read the notes I've added in code comments.</div>
<!-- the glyphicon class provides the info icon.-->
<p>Basketball <span class="glyphicon glyphicon-info-sign" id="basketball" data-toggle="popover"></span></p>
<p>Baseball <span class="glyphicon glyphicon-info-sign" id="baseball" data-toggle="popover"></span></p>
<p>Football <span class="glyphicon glyphicon-info-sign" id="football" data-toggle="popover"></span></p>
<p>Soccer <span class="glyphicon glyphicon-info-sign" id="soccer" data-toggle="popover"></span></p>

View File

@ -1,19 +0,0 @@
---
layout: null
search: exclude
---
{
"entries":
[
{% for page in site.tooltips %}
{
"doc_id": "{{ page.doc_id }}",
"body": "{{ page.content | strip_newlines | replace: '\', '\\\\' | replace: '"', '\\"' }}"
} {% unless forloop.last %},{% endunless %}
{% endfor %}
]
}