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 jquery-1.7.2.min
//= require anchor.min.js
//= require mousetrap.min //= require mousetrap.min
//= require gollum //= require gollum
//= require gollum.dialog //= require gollum.dialog
@@ -486,23 +486,8 @@ $(document).ready(function() {
// Set text direction auto // Set text direction auto
$('.markdown-body p, .markdown-body span, .markdown-body pre, .markdown-body table').attr('dir','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 // 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'); header = $(anchor).closest(':header');
if (header.hasClass('editable')){ if (header.hasClass('editable')){
var newUrl = routePath('edit') + '/' + pageName() + $(anchor).attr('href'); var newUrl = routePath('edit') + '/' + pageName() + $(anchor).attr('href');
@@ -79,20 +79,28 @@ a {
overflow: hidden; overflow: hidden;
word-wrap: break-word; word-wrap: break-word;
.anchorjs-link { .anchor {
display: inline-block; display: inline-block;
position: absolute;
opacity: 0;
background: url('data:image/svg+xml;utf8,<%= rocticon_css(:link) %>') no-repeat; background: url('data:image/svg+xml;utf8,<%= rocticon_css(:link) %>') no-repeat;
margin-left: -0.8em !important; background-size: 0.6em 1.35em;
margin-top: 0.4em; padding-right: 0.5em;
padding-top: 0.4em;
margin-left: -0.8em;
width: 1em; width: 1em;
height: 0.6em; height: 1em;
text-decoration: none; text-decoration: none;
transition-property: opacity; transition-property: opacity;
transition: 0.1s; transition: 0.1s;
transition-delay: 0.5s; transition-delay: 0.5s;
} }
.anchorjs-link.edit { *:hover > .anchor, .anchor:focus{
opacity: 1;
}
.anchor.edit {
margin-left: 2em !important; margin-left: 2em !important;
margin-top: 0.5em; margin-top: 0.5em;
height: 0.5em; height: 0.5em;