From b40bf3aef7359c181eea04c06ec52b62cc72aaaf Mon Sep 17 00:00:00 2001
From: Cheng-Han, Wu
Date: Wed, 20 Apr 2016 18:22:18 +0800
Subject: Update to support octicon and change header anchor styles
---
public/js/extra.js | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
(limited to 'public/js')
diff --git a/public/js/extra.js b/public/js/extra.js
index 83d62d4d..fd9fba6b 100644
--- a/public/js/extra.js
+++ b/public/js/extra.js
@@ -613,9 +613,9 @@ function imgPlayiframe(element, src) {
var anchorForId = function (id) {
var anchor = document.createElement("a");
- anchor.className = "header-link hidden-xs";
+ anchor.className = "anchor hidden-xs";
anchor.href = "#" + id;
- anchor.innerHTML = "";
+ anchor.innerHTML = "";
anchor.title = id;
return anchor;
};
@@ -624,13 +624,13 @@ var linkifyAnchors = function (level, containingElement) {
var headers = containingElement.getElementsByTagName("h" + level);
for (var h = 0; h < headers.length; h++) {
var header = headers[h];
- if (header.getElementsByClassName("header-link").length == 0) {
+ if (header.getElementsByClassName("anchor").length == 0) {
if (typeof header.id == "undefined" || header.id == "") {
//to escape characters not allow in css and humanize
var id = slugifyWithUTF8(header.innerHTML);
header.id = id;
}
- header.appendChild(anchorForId(header.id));
+ header.insertBefore(anchorForId(header.id), header.firstChild);
}
}
};
--
cgit v1.2.3