diff options
| author | Yehonal <yehonal.azeroth@gmail.com> | 2018-12-16 15:54:48 +0100 |
|---|---|---|
| committer | Yehonal <yehonal.azeroth@gmail.com> | 2018-12-16 16:35:55 +0100 |
| commit | 4a8156e08a5e3ffe540f56ecb894b951dd9b7c84 (patch) | |
| tree | e14862984ffba17f4a8fe53d90b937917014827a | |
| parent | d910d7263f43ddce21dbab7345dd679dc5b092b6 (diff) | |
| download | wiki-4a8156e08a5e3ffe540f56ecb894b951dd9b7c84.tar.gz wiki-4a8156e08a5e3ffe540f56ecb894b951dd9b7c84.tar.bz2 wiki-4a8156e08a5e3ffe540f56ecb894b951dd9b7c84.zip | |
Git-Wiki 2.0
29 files changed, 415 insertions, 288 deletions
@@ -1 +1,2 @@ -_site
\ No newline at end of file +_site +Gemfile.lock
\ No newline at end of file diff --git a/_config.yml.dist b/_config.yml.dist index 8a115bb..2e3fd39 100644 --- a/_config.yml.dist +++ b/_config.yml.dist @@ -8,11 +8,22 @@ theme: wiki_folder: wiki use_github_wiki: false use_prose_io: true -google_cse_token: -custom_head: false -custom_sidebar: false -custom_footer: false -gems: +google_cse_token: +defaults: + - + scope: + path: "" # an empty string here means all files in the project + values: + layout: "git-wiki-default" + - + scope: + path: "" + type: "pages" + values: + layout: "git-wiki-default" +sass: + style: compressed +plugins: - jekyll-sitemap - jekyll-mentions - jemoji diff --git a/_includes/drassil_comments/comments.html b/_includes/drassil_comments/comments.html new file mode 100644 index 0000000..bf4d761 --- /dev/null +++ b/_includes/drassil_comments/comments.html @@ -0,0 +1,20 @@ +<div id="disqus_thread"></div> +<script> + + /** + * RECOMMENDED CONFIGURATION VARIABLES: EDIT AND UNCOMMENT THE SECTION BELOW TO INSERT DYNAMIC VALUES FROM YOUR PLATFORM OR CMS. + * LEARN WHY DEFINING THESE VARIABLES IS IMPORTANT: https://disqus.com/admin/universalcode/#configuration-variables*/ + /* + var disqus_config = function () { + this.page.url = PAGE_URL; // Replace PAGE_URL with your page's canonical URL variable + this.page.identifier = PAGE_IDENTIFIER; // Replace PAGE_IDENTIFIER with your page's unique identifier variable + }; + */ + (function () { // DON'T EDIT BELOW THIS LINE + var d = document, s = d.createElement('script'); + s.src = 'https://git-wiki.disqus.com/embed.js'; + s.setAttribute('data-timestamp', +new Date()); + (d.head || d.body).appendChild(s); + })(); +</script> +<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
\ No newline at end of file diff --git a/_includes/drassil_sidebar/sidebar.html b/_includes/drassil_sidebar/sidebar.html new file mode 100644 index 0000000..4b7a396 --- /dev/null +++ b/_includes/drassil_sidebar/sidebar.html @@ -0,0 +1,6 @@ +Menu: + +<ul> + <li><a href="{{ '/' | relative_url }}">Home</a></li> + <li><a href="{{ '/wiki/examples.html' | relative_url }}">Made with Git-Wiki</a> +</ul>
\ No newline at end of file diff --git a/_includes/gw_content/body.html b/_includes/gw_content/body.html new file mode 100644 index 0000000..5edfa9b --- /dev/null +++ b/_includes/gw_content/body.html @@ -0,0 +1,5 @@ +<body> + {% include gw_content/wrapper.html %} + + {% include gw_tail/tail.html %} +</body>
\ No newline at end of file diff --git a/_includes/gw_content/content.html b/_includes/gw_content/content.html new file mode 100644 index 0000000..347f69d --- /dev/null +++ b/_includes/gw_content/content.html @@ -0,0 +1,25 @@ +<section> + {% include gw_tools/tools.html %} + + {% if site.inc_before_toc %} + {% include {{ site.inc_before_toc }} %} + {% endif %} + + <div id="toc"></div> + + {% if site.inc_after_toc %} + {% include {{ site.inc_after_toc }} %} + {% endif %} + + {% if site.inc_before_content %} + {% include {{ site.inc_before_content }} %} + {% endif %} + + <div id="content"> + {{ content }} + </div> + + {% if site.inc_after_content %} + {% include {{ site.inc_after_content }} %} + {% endif %} +</section>
\ No newline at end of file diff --git a/_includes/gw_content/wrapper.html b/_includes/gw_content/wrapper.html new file mode 100644 index 0000000..9fb0223 --- /dev/null +++ b/_includes/gw_content/wrapper.html @@ -0,0 +1,5 @@ +<div class="wrapper"> + {% include gw_header/header.html %} + {% include gw_content/content.html %} + {% include gw_footer/footer.html %} +</div>
\ No newline at end of file diff --git a/_includes/gw_defines/defines.html b/_includes/gw_defines/defines.html new file mode 100644 index 0000000..d479d72 --- /dev/null +++ b/_includes/gw_defines/defines.html @@ -0,0 +1,5 @@ +{% assign version = "1.0.5" %} +{% capture lchar %}{{page.url | slice: -1, 1}}{% endcapture %} +{% capture url %} +{% if lchar == "/" %}{{page.url}}index.html{% else %}{{ page.url | default: 'index.html' }}{% endif%} +{% endcapture %}
\ No newline at end of file diff --git a/_includes/gw_footer/footer.html b/_includes/gw_footer/footer.html new file mode 100644 index 0000000..7aed17c --- /dev/null +++ b/_includes/gw_footer/footer.html @@ -0,0 +1,19 @@ +<footer> + {% if site.inc_before_footer %} + {% include {{ site.inc_before_footer }} %} + {% endif %} + + {% if site.github.is_project_page %} + <p>This project is maintained by <a href="{{ site.github.owner_url }}">{{ site.github.owner_name }}</a></p> + {% endif %} + <p><small>Hosted on GitHub Pages — Powered by <a href="https://github.com/Drassil/git-wiki">Git-Wiki v{{ + version }}</a> </p> + + {% if site.github.is_project_page %} + <p class="view"><a href="{{ site.github.repository_url }}">View the Project on GitHub <small>{{ github_name }}</small></a></p> + {% endif %} + + {% if site.inc_after_footer %} + {% include {{ site.inc_after_footer }} %} + {% endif %} +</footer>
\ No newline at end of file diff --git a/_includes/gw_head/head.html b/_includes/gw_head/head.html new file mode 100644 index 0000000..cf82bd9 --- /dev/null +++ b/_includes/gw_head/head.html @@ -0,0 +1,13 @@ +<head> + {% if site.inc_before_head %} + {% include {{ site.inc_before_head }} %} + {% endif %} + + {% include gw_head/meta.html %} + {% include gw_head/scripts.html %} + {% include gw_head/styles.html %} + + {% if site.inc_after_head %} + {% include {{ site.inc_after_head }} %} + {% endif %} +</head>
\ No newline at end of file diff --git a/_includes/gw_head/meta.html b/_includes/gw_head/meta.html new file mode 100644 index 0000000..141ab05 --- /dev/null +++ b/_includes/gw_head/meta.html @@ -0,0 +1,12 @@ +{% if site.inc_before_meta %} +{% include {{ site.inc_before_meta }} %} +{% endif %} + +<meta charset="utf-8"> +<meta http-equiv="X-UA-Compatible" content="chrome=1"> +<meta name="viewport" content="width=device-width"> +<title>{{ site.title | default: site.github.repository_name }} by {{ site.github.owner_name }}</title> + +{% if site.inc_after_meta %} +{% include {{ site.inc_after_meta }} %} +{% endif %}
\ No newline at end of file diff --git a/_includes/gw_head/scripts.html b/_includes/gw_head/scripts.html new file mode 100644 index 0000000..65ee4ff --- /dev/null +++ b/_includes/gw_head/scripts.html @@ -0,0 +1,15 @@ +{% if site.inc_before_scripts %} +{% include {{ site.inc_before_scripts }} %} +{% endif %} + +<script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" + crossorigin="anonymous"></script> +<script src="{{ '/assets/js/toc.js' | relative_url }}"></script> +<script src="{{ '/assets/js/red-links.js' | relative_url }}"></script> +<!--[if lt IE 9]> + <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> + <![endif]--> + +{% if site.inc_after_scripts %} +{% include {{ site.inc_after_scripts }} %} +{% endif %}
\ No newline at end of file diff --git a/_includes/gw_head/styles.html b/_includes/gw_head/styles.html new file mode 100644 index 0000000..3bb7ecc --- /dev/null +++ b/_includes/gw_head/styles.html @@ -0,0 +1,9 @@ +{% if site.inc_before_styles %} +{% include {{ site.inc_before_styles }} %} +{% endif %} + +<link rel="stylesheet" href="{{ '/assets/css/git-wiki-style.css?v=' | append: site.github.build_revision | relative_url }}"> + +{% if site.inc_after_styles %} +{% include {{ site.inc_after_styles }} %} +{% endif %}
\ No newline at end of file diff --git a/_includes/gw_header/downloads.html b/_includes/gw_header/downloads.html new file mode 100644 index 0000000..8f654f9 --- /dev/null +++ b/_includes/gw_header/downloads.html @@ -0,0 +1,5 @@ +<ul class="downloads"> + <li><a href="{{ site.github.zip_url }}">Download <strong>ZIP File</strong></a></li> + <li><a href="{{ site.github.tar_url }}">Download <strong>TAR Ball</strong></a></li> + <li><a href="{{ site.github.repository_url }}">View On <strong>GitHub</strong></a></li> +</ul>
\ No newline at end of file diff --git a/_includes/gw_header/header.html b/_includes/gw_header/header.html new file mode 100644 index 0000000..1b0b74c --- /dev/null +++ b/_includes/gw_header/header.html @@ -0,0 +1,21 @@ +<header> + {% if site.inc_before_header %} + {% include {{ site.inc_before_header }} %} + {% endif %} + + {% if site.show_downloads %} + {% include gw_header/logo.html %} + {% endif %} + + {% if site.github.is_user_page %} + <p class="view"><a href="{{ site.github.owner_url }}">View My GitHub Profile</a></p> + {% endif %} + + {% if site.show_downloads %} + {% include gw_header/downloads.html %} + {% endif %} + + {% if site.inc_after_header %} + {% include {{ site.inc_after_header }} %} + {% endif %} +</header>
\ No newline at end of file diff --git a/_includes/gw_header/logo.html b/_includes/gw_header/logo.html new file mode 100644 index 0000000..a4a36c3 --- /dev/null +++ b/_includes/gw_header/logo.html @@ -0,0 +1,4 @@ +<a href="{{ '/' | relative_url }}"><img src="{{ site.logo_url }}"> + <h1>{{ site.title | default: site.github.repository_name }}</h1> +</a> +<p>{{ site.description | default: site.github.project_tagline }}</p>
\ No newline at end of file diff --git a/_includes/gw_tail/tail.html b/_includes/gw_tail/tail.html new file mode 100644 index 0000000..e86191c --- /dev/null +++ b/_includes/gw_tail/tail.html @@ -0,0 +1,34 @@ +{% if site.inc_before_tail %} +{% include {{ site.inc_before_tail }} %} +{% endif %} + +<script src="{{ '/assets/js/scale.fix.js' | relative_url }}"></script> + +{% if site.google_analytics %} +<script> + (function (i, s, o, g, r, a, m) { + i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function () { + (i[r].q = i[r].q || []).push(arguments) + }, i[r].l = 1 * new Date(); a = s.createElement(o), + m = s.getElementsByTagName(o)[0]; a.async = 1; a.src = g; m.parentNode.insertBefore(a, m) + })(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga'); + + ga('create', '{{ site.google_analytics }}', 'auto'); + ga('send', 'pageview'); +</script> +{% endif %} + +<script type="text/javascript"> + $(document).ready(function () { + $('#toc').toc({ + title: '<i>Contents</i>', + showSpeed: 0, + headers: '#content h1, #content h2, #content h3, #content h4, #content h5, #content h6' + }); + $(document.body).redLinks(); + }); +</script> + +{% if site.inc_after_tail %} +{% include {{ site.inc_after_tail }} %} +{% endif %}
\ No newline at end of file diff --git a/_includes/gw_tools/page_actions.html b/_includes/gw_tools/page_actions.html new file mode 100644 index 0000000..927b178 --- /dev/null +++ b/_includes/gw_tools/page_actions.html @@ -0,0 +1,14 @@ +{{page.relative_path}} +{% if site.use_github_wiki %} +<span class="tools-element"><a target="_blank" href="{{ site.github.repository_url }}/{{page.folder}}{{url | remove: '.html' | append: ''}}/_edit">Edit</a></span> +<span class="tools-element"><a target="_blank" href="{{ site.github.repository_url }}/{{page.folder}}{{url | remove: '.html' | append: ''}}/_history">History</a></span> +<span class="tools-element"><a target="_blank" href="{{ site.github.repository_url }}/{{page.folder}}{{url | remove: '.html' | append: '.md'}}/">Source</a></span> +{% else %} +<span class="tools-element"><a target="_blank" href="{{ site.github.repository_url }}/edit/{{site.git_branch}}{{page.folder}}{{url | remove: '.html' | append: '.md'}}">Edit</a></span> +{% if site.use_prose_io %} +<span class="tools-element"><a target="_blank" href="http://prose.io/#{{site.github.repository_nwo}}/edit/{{site.git_branch}}{{page.folder}}{{url | remove: '.html' | append: '.md'}}">Edit + with Prose.io</a></span> +{% endif %} +<span class="tools-element"><a target="_blank" href="{{ site.github.repository_url }}/commits/{{site.git_branch}}{{page.folder}}{{url | remove: '.html' | append: '.md'}}">History</a></span> +<span class="tools-element"><a target="_blank" href="{{ site.github.repository_url }}/blob/{{site.git_branch}}{{page.folder}}{{url | remove: '.html' | append: '.md'}}">Source</a></span> +{% endif %}
\ No newline at end of file diff --git a/_includes/gw_tools/search_module.html b/_includes/gw_tools/search_module.html new file mode 100644 index 0000000..f79335a --- /dev/null +++ b/_includes/gw_tools/search_module.html @@ -0,0 +1,25 @@ +{% if site.google_cse_token %} +<script> + (function () { + var cx = "{{site.google_cse_token}}"; + var gcse = document.createElement('script'); + gcse.type = 'text/javascript'; + gcse.async = true; + gcse.src = 'https://cse.google.com/cse.js?cx=' + cx; + var s = document.getElementsByTagName('script')[0]; + s.parentNode.insertBefore(gcse, s); + })(); +</script> +<gcse:search></gcse:search> +{% else %} +<form method="GET" action="{{ site.github.repository_url }}/search"> + <input type="text" name="q[]" placeholder="Text to search"> + {% if site.use_github_wiki %} + <input type="hidden" name="type" value="Wikis"> + {% else %} + <!-- <input type="hidden" name="l" value="Markdown"> --> + <input type="hidden" name="q[]" value="path:/{{ site.wiki_folder }}"> + {% endif %} + <input type="submit" value="Search"> +</form> +{% endif %}
\ No newline at end of file diff --git a/_includes/gw_tools/tools.html b/_includes/gw_tools/tools.html new file mode 100644 index 0000000..c0b50f7 --- /dev/null +++ b/_includes/gw_tools/tools.html @@ -0,0 +1,13 @@ +<div id="tools-buttons" style="width: 100%; text-align: right"> + {% if site.inc_before_tools %} + {% include {{ site.inc_before_tools }} %} + {% endif %} + + {% include gw_tools/page_actions.html %} + + {% include gw_tools/search_module.html %} + + {% if site.inc_after_tools %} + {% include {{ site.inc_after_tools }} %} + {% endif %} +</div>
\ No newline at end of file diff --git a/_layouts/default.html b/_layouts/default.html deleted file mode 100644 index 4f08612..0000000 --- a/_layouts/default.html +++ /dev/null @@ -1,146 +0,0 @@ -<!doctype html> -<html> - <head> - {% assign version = "1.0.5" %} - {% capture lchar %}{{page.url | slice: -1, 1}}{% endcapture %} - {% capture url %}{% if lchar == "/" %}{{page.url}}index.html{% else %}{{ page.url | default: 'index.html' }}{% endif %}{% endcapture %} - <meta charset="utf-8"> - <meta http-equiv="X-UA-Compatible" content="chrome=1"> - <title>{{ site.title | default: site.github.repository_name }} by {{ site.github.owner_name }}</title> - - <script - src="https://code.jquery.com/jquery-3.2.1.min.js" - integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" - crossorigin="anonymous"></script> - - <link rel="stylesheet" href="{{ '/assets/css/style.css?v=' | append: site.github.build_revision | relative_url }}"> - <script src="{{ '/assets/js/wiki-features.js' | relative_url }}"></script> - - {% if site.custom_head %} - {% include head.html %} - {% endif %} - - <meta name="viewport" content="width=device-width"> - <!--[if lt IE 9]> - <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> - <![endif]--> - </head> - <body> - <div class="wrapper"> - <header> - <a href="{{ '/' | relative_url }}"><img src="{{ site.logo_url }}"> - <h1>{{ site.title | default: site.github.repository_name }}</h1> - </a> - <p>{{ site.description | default: site.github.project_tagline }}</p> - - {% if site.github.is_user_page %} - <p class="view"><a href="{{ site.github.owner_url }}">View My GitHub Profile</a></p> - {% endif %} - - {% if site.show_downloads %} - <ul class="downloads"> - <li><a href="{{ site.github.zip_url }}">Download <strong>ZIP File</strong></a></li> - <li><a href="{{ site.github.tar_url }}">Download <strong>TAR Ball</strong></a></li> - <li><a href="{{ site.github.repository_url }}">View On <strong>GitHub</strong></a></li> - </ul> - {% endif %} - - {% if site.custom_sidebar %} - {% include sidebar.html %} - {% endif %} - - </header> - <section> - <div id="tools-buttons" style="width: 100%; text-align: right"> - {{page.relative_path}} - {% if site.use_github_wiki %} - <span class="tools-element"><a target="_blank" href="{{ site.github.repository_url }}/{{page.folder}}{{url | remove: '.html' | append: ''}}/_edit">Edit</a></span> - <span class="tools-element"><a target="_blank" href="{{ site.github.repository_url }}/{{page.folder}}{{url | remove: '.html' | append: ''}}/_history">History</a></span> - <span class="tools-element"><a target="_blank" href="{{ site.github.repository_url }}/{{page.folder}}{{url | remove: '.html' | append: '.md'}}/">Source</a></span> - {% else %} - <span class="tools-element"><a target="_blank" href="{{ site.github.repository_url }}/edit/{{site.git_branch}}{{page.folder}}{{url | remove: '.html' | append: '.md'}}">Edit</a></span> - {% if site.use_prose_io %} - <span class="tools-element"><a target="_blank" href="http://prose.io/#{{site.github.repository_nwo}}/edit/{{site.git_branch}}{{page.folder}}{{url | remove: '.html' | append: '.md'}}">Edit with Prose.io</a></span> - {% endif %} - <span class="tools-element"><a target="_blank" href="{{ site.github.repository_url }}/commits/{{site.git_branch}}{{page.folder}}{{url | remove: '.html' | append: '.md'}}">History</a></span> - <span class="tools-element"><a target="_blank" href="{{ site.github.repository_url }}/blob/{{site.git_branch}}{{page.folder}}{{url | remove: '.html' | append: '.md'}}">Source</a></span> - {% endif %} - - {% if site.google_cse_token %} - <script> - (function() { - var cx = "{{site.google_cse_token}}"; - var gcse = document.createElement('script'); - gcse.type = 'text/javascript'; - gcse.async = true; - gcse.src = 'https://cse.google.com/cse.js?cx=' + cx; - var s = document.getElementsByTagName('script')[0]; - s.parentNode.insertBefore(gcse, s); - })(); - </script> - <gcse:search></gcse:search> - {% else %} - <form method="GET" action="{{ site.github.repository_url }}/search"> - <input type="text" name="q[]" placeholder="Text to search"> - {% if site.use_github_wiki %} - <input type="hidden" name="type" value="Wikis"> - {% else %} - <!-- <input type="hidden" name="l" value="Markdown"> --> - <input type="hidden" name="q[]" value="path:/{{ site.wiki_folder }}"> - {% endif %} - <input type="submit" value="Search"> - </form> - {% endif %} - </div> - - <div id="toc"></div> - - <div id="content"> - {{ content }} - </div> - - {% if site.comments %} - {% include comments.html %} - {% endif %} - - </section> - <footer> - {% if site.custom_footer %} - {% include footer.html %} - {% endif %} - - {% if site.github.is_project_page %} - <p>This project is maintained by <a href="{{ site.github.owner_url }}">{{ site.github.owner_name }}</a></p> - {% endif %} - <p><small>Hosted on GitHub Pages — Powered by <a href="https://github.com/Drassil/git-wiki">Git-Wiki v{{ version }}</a> </p> - {% if site.github.is_project_page %} - <p class="view"><a href="{{ site.github.repository_url }}">View the Project on GitHub <small>{{ github_name }}</small></a></p> - {% endif %} - </footer> - </div> - <script src="{{ '/assets/js/scale.fix.js' | relative_url }}"></script> - - - {% if site.google_analytics %} - <script> - (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ - (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), - m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) - })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); - - ga('create', '{{ site.google_analytics }}', 'auto'); - ga('send', 'pageview'); - </script> - {% endif %} - - <script type="text/javascript"> - $(document).ready(function() { - $('#toc').toc({ - title: '<i>Contents</i>', - showSpeed: 0, - headers: '#content h1, #content h2, #content h3, #content h4, #content h5, #content h6' }); - $(document.body).redLinks(); - }); - </script> - </body> -</html> diff --git a/_layouts/git-wiki-default.html b/_layouts/git-wiki-default.html new file mode 100644 index 0000000..8bb038b --- /dev/null +++ b/_layouts/git-wiki-default.html @@ -0,0 +1,9 @@ +{% include gw_defines/defines.html %} + +<!doctype html> +<html> +{% include gw_head/head.html %} + +{% include gw_content/body.html %} + +</html>
\ No newline at end of file diff --git a/_layouts/page.html b/_layouts/page.html deleted file mode 100644 index 5e71126..0000000 --- a/_layouts/page.html +++ /dev/null @@ -1,5 +0,0 @@ ---- -layout: default ---- - -{{ content }} diff --git a/_sass/style.scss b/_sass/git-wiki-style.scss index c40fd08..c40fd08 100644 --- a/_sass/style.scss +++ b/_sass/git-wiki-style.scss diff --git a/assets/css/git-wiki-style.scss b/assets/css/git-wiki-style.scss new file mode 100644 index 0000000..34e537a --- /dev/null +++ b/assets/css/git-wiki-style.scss @@ -0,0 +1,4 @@ +--- +--- + +@import "git-wiki-style.scss"; diff --git a/assets/css/style.scss b/assets/css/style.scss deleted file mode 100644 index 72a6aed..0000000 --- a/assets/css/style.scss +++ /dev/null @@ -1,4 +0,0 @@ ---- ---- - -@import "style.scss"; diff --git a/assets/js/red-links.js b/assets/js/red-links.js new file mode 100644 index 0000000..446db02 --- /dev/null +++ b/assets/js/red-links.js @@ -0,0 +1,28 @@ + +(function ($) { + // + // RED LINK FEATURE (Hacky) + // TODO: filter external links + $.fn.redLinks = function () { + $('a').each(function () { + // avoid red link for external urls + if (this.hostname != window.location.hostname) + return; + + var that = this; + $.ajax({ + type: 'HEAD', + url: this.href, + success: function () { + + }, + error: function (xhr, ajaxOptions, thrownError) { + if (xhr.status == 404) { + $(that).css('color', 'red'); + } + } + }); + }); + }; + +})(jQuery); diff --git a/assets/js/toc.js b/assets/js/toc.js new file mode 100644 index 0000000..d8fcf33 --- /dev/null +++ b/assets/js/toc.js @@ -0,0 +1,106 @@ + +// https://github.com/ghiculescu/jekyll-table-of-contents +(function ($) { + $.fn.toc = function (options) { + var defaults = { + noBackToTopLinks: false, + title: '<i>Jump to...</i>', + minimumHeaders: 3, + headers: 'h1, h2, h3, h4, h5, h6', + listType: 'ol', // values: [ol|ul] + showEffect: 'show', // values: [show|slideDown|fadeIn|none] + showSpeed: 'slow', // set to 0 to deactivate effect + classes: { + list: '', + item: '' + } + }, + settings = $.extend(defaults, options); + + function fixedEncodeURIComponent(str) { + return encodeURIComponent(str).replace(/[!'()*]/g, function (c) { + return '%' + c.charCodeAt(0).toString(16); + }); + } + + function createLink(header) { + var innerText = (header.textContent === undefined) ? header.innerText : header.textContent; + return "<a href='#" + fixedEncodeURIComponent(header.id) + "'>" + innerText + "</a>"; + } + + var headers = $(settings.headers).filter(function () { + // get all headers with an ID + var previousSiblingName = $(this).prev().attr("name"); + if (!this.id && previousSiblingName) { + this.id = $(this).attr("id", previousSiblingName.replace(/\./g, "-")); + } + + // Yehonal + if (!this.id) { + this.id = $(this).text().replace(/\W/g, '_'); + } + + return this.id; + }), output = $(this); + if (!headers.length || headers.length < settings.minimumHeaders || !output.length) { + $(this).hide(); + return; + } + + if (0 === settings.showSpeed) { + settings.showEffect = 'none'; + } + + var render = { + show: function () { output.hide().html(html).show(settings.showSpeed); }, + slideDown: function () { output.hide().html(html).slideDown(settings.showSpeed); }, + fadeIn: function () { output.hide().html(html).fadeIn(settings.showSpeed); }, + none: function () { output.html(html); } + }; + + var get_level = function (ele) { return parseInt(ele.nodeName.replace("H", ""), 10); }; + var highest_level = headers.map(function (_, ele) { return get_level(ele); }).get().sort()[0]; + var return_to_top = '<i class="icon-arrow-up back-to-top"> </i>'; + + var level = get_level(headers[0]), + this_level, + html = settings.title + " <" + settings.listType + " class=\"" + settings.classes.list + "\">"; + headers.on('click', function () { + if (!settings.noBackToTopLinks) { + window.location.hash = this.id; + } + }) + .addClass('clickable-header') + .each(function (_, header) { + this_level = get_level(header); + if (!settings.noBackToTopLinks && this_level === highest_level) { + $(header).addClass('top-level-header').after(return_to_top); + } + if (this_level === level) // same level as before; same indenting + html += "<li class=\"" + settings.classes.item + "\">" + createLink(header); + else if (this_level <= level) { // higher level than before; end parent ol + for (var i = this_level; i < level; i++) { + html += "</li></" + settings.listType + ">" + } + html += "<li class=\"" + settings.classes.item + "\">" + createLink(header); + } + else if (this_level > level) { // lower level than before; expand the previous to contain a ol + for (i = this_level; i > level; i--) { + html += "<" + settings.listType + " class=\"" + settings.classes.list + "\">" + + "<li class=\"" + settings.classes.item + "\">" + } + html += createLink(header); + } + level = this_level; // update for the next one + }); + html += "</" + settings.listType + ">"; + if (!settings.noBackToTopLinks) { + $(document).on('click', '.back-to-top', function () { + $(window).scrollTop(0); + window.location.hash = ''; + }); + } + + render[settings.showEffect](); + }; +})(jQuery); diff --git a/assets/js/wiki-features.js b/assets/js/wiki-features.js deleted file mode 100644 index 41e5216..0000000 --- a/assets/js/wiki |
