Remove AnchorJS, native anchor styling

This commit is contained in:
Dawa Ometto
2019-08-28 23:51:05 +02:00
parent 6d44bd7bc8
commit 2f2487150a
4 changed files with 16 additions and 33 deletions
File diff suppressed because one or more lines are too long
@@ -1,5 +1,4 @@
//= require jquery-1.7.2.min
//= require anchor.min.js
//= require mousetrap.min
//= require gollum
//= require gollum.dialog
@@ -486,23 +486,8 @@ $(document).ready(function() {
// Set text direction auto
$('.markdown-body p, .markdown-body span, .markdown-body pre, .markdown-body table').attr('dir','auto');
// Setup anchors with AnchorJS
// Normal link anchors first
anchors.options = {
icon: '',
placement: 'left',
visible: 'hover'
};
var anchorSelectors = [];
//h1-h6
for (var i = 1; i < 7; i++){
anchorSelectors.push('.markdown-body h' + i.toString());
}
anchors.add(anchorSelectors.join(', '));
// Copy anchors for each editable header and give it the new anchor the 'edit' class, to display a link to edit the section
$('a.anchorjs-link').each(function (index, anchor) {
$('a.anchor').each(function (index, anchor) {
header = $(anchor).closest(':header');
if (header.hasClass('editable')){
var newUrl = routePath('edit') + '/' + pageName() + $(anchor).attr('href');
@@ -79,26 +79,34 @@ a {
overflow: hidden;
word-wrap: break-word;
.anchorjs-link {
.anchor {
display: inline-block;
position: absolute;
opacity: 0;
background: url('data:image/svg+xml;utf8,<%= rocticon_css(:link) %>') no-repeat;
margin-left: -0.8em !important;
margin-top: 0.4em;
background-size: 0.6em 1.35em;
padding-right: 0.5em;
padding-top: 0.4em;
margin-left: -0.8em;
width: 1em;
height: 0.6em;
height: 1em;
text-decoration: none;
transition-property: opacity;
transition: 0.1s;
transition: 0.1s;
transition-delay: 0.5s;
}
.anchorjs-link.edit {
*:hover > .anchor, .anchor:focus{
opacity: 1;
}
.anchor.edit {
margin-left: 2em !important;
margin-top: 0.5em;
height: 0.5em;
background: url('data:image/svg+xml;utf8,<%= rocticon_css(:pencil) %>') no-repeat;
}
a {
&.absent {
color: $red;