You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by lu...@apache.org on 2014/12/31 11:10:10 UTC

[3/6] struts-site git commit: Adds auto anchor support

Adds auto anchor support


Project: http://git-wip-us.apache.org/repos/asf/struts-site/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts-site/commit/eac88987
Tree: http://git-wip-us.apache.org/repos/asf/struts-site/tree/eac88987
Diff: http://git-wip-us.apache.org/repos/asf/struts-site/diff/eac88987

Branch: refs/heads/master
Commit: eac88987f252db0bc13b76b23a326fd5f1c3de9d
Parents: 952ba79
Author: Lukasz Lenart <lu...@gmail.com>
Authored: Wed Dec 31 11:09:07 2014 +0100
Committer: Lukasz Lenart <lu...@gmail.com>
Committed: Wed Dec 31 11:09:07 2014 +0100

----------------------------------------------------------------------
 source/_layouts/default.html   | 20 ++++++++++++++++++--
 source/_layouts/main-page.html |  5 +++--
 source/css/custom.css          | 24 ++++++++++++++++++++++++
 3 files changed, 45 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts-site/blob/eac88987/source/_layouts/default.html
----------------------------------------------------------------------
diff --git a/source/_layouts/default.html b/source/_layouts/default.html
index 98cca1f..e855045 100644
--- a/source/_layouts/default.html
+++ b/source/_layouts/default.html
@@ -10,9 +10,11 @@
   <title>{{ page.title }}</title>
 
   <link href="//fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,400italic,600italic,700italic" rel="stylesheet" type="text/css">
-  <link rel="stylesheet" href="css/main.css">
+  <link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
+  <link href="css/main.css" rel="stylesheet">
+  <link href="css/custom.css" rel="stylesheet">
 
-  <script type="text/javascript" src="js/jquery-1.11.0.min.js"></script>
+  <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
   <script type="text/javascript" src="bootstrap/js/bootstrap.js"></script>
   <script type="text/javascript" src="js/community.js"></script>
 </head>
@@ -28,5 +30,19 @@
 
 {% include footer.html %}
 
+<script>
+$(function() {
+  return $("h2, h3, h4, h5, h6").each(function(i, el) {
+    var $el, icon, id;
+    $el = $(el);
+    id = $el.attr('id');
+    icon = '<i class="fa fa-link"></i>';
+    if (id) {
+      return $el.prepend($("<a />").addClass("header-link").attr("href", "#" + id).html(icon));
+    }
+  });
+});
+</script>
+
 </body>
 </html>

http://git-wip-us.apache.org/repos/asf/struts-site/blob/eac88987/source/_layouts/main-page.html
----------------------------------------------------------------------
diff --git a/source/_layouts/main-page.html b/source/_layouts/main-page.html
index fa44f3f..2b3c8bd 100644
--- a/source/_layouts/main-page.html
+++ b/source/_layouts/main-page.html
@@ -10,9 +10,10 @@
   <title>{{ page.title }}</title>
 
   <link href="//fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,400italic,600italic,700italic" rel="stylesheet" type="text/css">
-  <link rel="stylesheet" href="css/main.css">
+  <link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
+  <link href="css/main.css" rel="stylesheet">
 
-  <script type="text/javascript" src="js/jquery-1.11.0.min.js"></script>
+  <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
   <script type="text/javascript" src="bootstrap/js/bootstrap.js"></script>
   <script type="text/javascript" src="js/community.js"></script>
 </head>

http://git-wip-us.apache.org/repos/asf/struts-site/blob/eac88987/source/css/custom.css
----------------------------------------------------------------------
diff --git a/source/css/custom.css b/source/css/custom.css
new file mode 100644
index 0000000..6d84573
--- /dev/null
+++ b/source/css/custom.css
@@ -0,0 +1,24 @@
+.header-link {
+  position: absolute;
+  right: -1em;
+  top: 0.1em;
+  opacity: 0;
+  font-size: 0.8em;
+
+  -webkit-transition: opacity 0.2s ease-in-out 0.1s;
+  -moz-transition: opacity 0.2s ease-in-out 0.1s;
+  -ms-transition: opacity 0.2s ease-in-out 0.1s;
+}
+
+h2, h3, h4, h5, h6 {
+  position: relative;
+  display: inline-block;
+}
+
+h2:hover .header-link,
+h3:hover .header-link,
+h4:hover .header-link,
+h5:hover .header-link,
+h6:hover .header-link {
+  opacity: 1;
+}