diff --git a/chrome/app/scripts/contentscript.js b/chrome/app/scripts/contentscript.js
index 3aa2f70..eb85e9f 100644
--- a/chrome/app/scripts/contentscript.js
+++ b/chrome/app/scripts/contentscript.js
@@ -2,7 +2,7 @@
var threeBarSvg = '';
-var getLinks = function() {
+var getLinks = function () {
var header, tag, headerLevelStr, depth;
var headers = document.querySelectorAll('article.markdown-body h1, article.markdown-body h2, article.markdown-body h3, article.markdown-body h4, article.markdown-body h5, article.markdown-body h6');
var links = [];
@@ -23,17 +23,17 @@ var getLinks = function() {
return links;
};
-var openList = function(depth) {
+var openList = function (depth) {
var html = '';
while (depth--) {
- html += '
';
+ html += '';
}
return html;
};
-var closeList = function(depth) {
+var closeList = function (depth) {
var html = '';
while (depth--) {
@@ -43,7 +43,7 @@ var closeList = function(depth) {
return html;
};
-var buildContents = function(links) {
+var buildContents = function (links) {
var node;
var contents = '';
var currentDepth = 1;
@@ -59,7 +59,7 @@ var buildContents = function(links) {
currentDepth = node.depth;
- contents += '- ' + node.text + '
';
+ contents += '- ' + node.text + '
';
}
while (currentDepth--) {
@@ -69,18 +69,8 @@ var buildContents = function(links) {
return contents;
};
-var insertContents = function(contents) {
+var insertContents = function (contents) {
var fileView = false;
- var readmeTarget = document.querySelectorAll('#readme > .Box-header > h3')[0];
- var markdownTarget;
-
- if (!readmeTarget) {
- markdownTarget = document.querySelectorAll('.file-actions')[0];
- }
-
- if (!readmeTarget && !markdownTarget) {
- return false;
- }
var oldLink = document.querySelectorAll('.github-markdown-contents')[0];
@@ -88,12 +78,21 @@ var insertContents = function(contents) {
oldLink.parentNode.removeChild(oldLink);
}
- var link = '';
- if (readmeTarget) {
- readmeTarget.parentNode.innerHTML += link;
- } else {
- markdownTarget.innerHTML += link;
- }
+ var link = '';
+
+ var fixDiv = document.createElement('div');
+ fixDiv.id = 'github-menu';
+ fixDiv.style.position = 'fixed';
+ fixDiv.style.zIndex = '99999';
+ fixDiv.style.left = '50%';
+ fixDiv.style.top = '0';
+ document.body.append(fixDiv);
+
+ fixDiv.innerHTML = link;
};
var links = getLinks();