2016-03-17 16:48:18 +00:00
|
|
|
// Get Parameters from some url
|
|
|
|
var getUrlParameter = function getUrlParameter(sPageURL) {
|
|
|
|
var url = sPageURL.split('?');
|
|
|
|
var obj = {};
|
|
|
|
if (url.length == 2) {
|
|
|
|
var sURLVariables = url[1].split('&'),
|
|
|
|
sParameterName,
|
|
|
|
i;
|
|
|
|
for (i = 0; i < sURLVariables.length; i++) {
|
|
|
|
sParameterName = sURLVariables[i].split('=');
|
|
|
|
obj[sParameterName[0]] = sParameterName[1];
|
|
|
|
}
|
|
|
|
}
|
2020-03-12 17:16:50 +00:00
|
|
|
return obj;
|
2016-03-17 16:48:18 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// Execute actions on images generated from Markdown pages
|
2017-07-27 19:42:07 +00:00
|
|
|
var images = $("div#body-inner img").not(".inline");
|
2016-03-17 16:48:18 +00:00
|
|
|
// Wrap image inside a featherlight (to get a full size view in a popup)
|
|
|
|
images.wrap(function(){
|
|
|
|
var image =$(this);
|
2019-10-06 11:32:21 +00:00
|
|
|
var o = getUrlParameter(image[0].src);
|
|
|
|
var f = o['featherlight'];
|
|
|
|
// IF featherlight is false, do not use feather light
|
|
|
|
if (f != 'false') {
|
|
|
|
if (!image.parent("a").length) {
|
|
|
|
return "<a href='" + image[0].src + "' data-featherlight='image'></a>";
|
|
|
|
}
|
2018-01-23 05:33:14 +00:00
|
|
|
}
|
2016-03-17 16:48:18 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
// Change styles, depending on parameters set to the image
|
|
|
|
images.each(function(index){
|
|
|
|
var image = $(this)
|
|
|
|
var o = getUrlParameter(image[0].src);
|
|
|
|
if (typeof o !== "undefined") {
|
|
|
|
var h = o["height"];
|
|
|
|
var w = o["width"];
|
|
|
|
var c = o["classes"];
|
|
|
|
image.css("width", function() {
|
|
|
|
if (typeof w !== "undefined") {
|
|
|
|
return w;
|
|
|
|
} else {
|
|
|
|
return "auto";
|
|
|
|
}
|
|
|
|
});
|
|
|
|
image.css("height", function() {
|
|
|
|
if (typeof h !== "undefined") {
|
|
|
|
return h;
|
|
|
|
} else {
|
|
|
|
return "auto";
|
|
|
|
}
|
|
|
|
});
|
|
|
|
if (typeof c !== "undefined") {
|
|
|
|
var classes = c.split(',');
|
|
|
|
for (i = 0; i < classes.length; i++) {
|
|
|
|
image.addClass(classes[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
2016-03-17 20:05:42 +00:00
|
|
|
|
2016-03-30 17:33:02 +00:00
|
|
|
// Stick the top to the top of the screen when scrolling
|
2017-11-23 18:46:56 +00:00
|
|
|
$(document).ready(function(){
|
|
|
|
$("#top-bar").sticky({topSpacing:0, zIndex: 1000});
|
2017-08-01 19:20:15 +00:00
|
|
|
});
|
2016-03-30 17:33:02 +00:00
|
|
|
|
|
|
|
|
|
|
|
jQuery(document).ready(function() {
|
|
|
|
// Add link button for every
|
2019-02-07 13:45:13 +00:00
|
|
|
var text, clip = new ClipboardJS('.anchor');
|
2016-03-30 17:33:02 +00:00
|
|
|
$("h1~h2,h1~h3,h1~h4,h1~h5,h1~h6").append(function(index, html){
|
|
|
|
var element = $(this);
|
2018-10-11 13:47:20 +00:00
|
|
|
var url = encodeURI(document.location.origin + document.location.pathname);
|
2016-03-30 17:33:02 +00:00
|
|
|
var link = url + "#"+element[0].id;
|
|
|
|
return " <span class='anchor' data-clipboard-text='"+link+"'>" +
|
2018-02-19 11:10:41 +00:00
|
|
|
"<i class='fas fa-link fa-lg'></i>" +
|
2016-03-30 17:33:02 +00:00
|
|
|
"</span>"
|
|
|
|
;
|
|
|
|
});
|
|
|
|
|
|
|
|
$(".anchor").on('mouseleave', function(e) {
|
|
|
|
$(this).attr('aria-label', null).removeClass('tooltipped tooltipped-s tooltipped-w');
|
|
|
|
});
|
|
|
|
|
|
|
|
clip.on('success', function(e) {
|
|
|
|
e.clearSelection();
|
|
|
|
$(e.trigger).attr('aria-label', 'Link copied to clipboard!').addClass('tooltipped tooltipped-s');
|
|
|
|
});
|
2018-12-28 09:46:09 +00:00
|
|
|
$('code.language-mermaid').each(function(index, element) {
|
2018-12-28 10:03:47 +00:00
|
|
|
var content = $(element).html().replace(/&/g, '&');
|
2018-12-28 09:46:09 +00:00
|
|
|
$(element).parent().replaceWith('<div class="mermaid" align="center">' + content + '</div>');
|
|
|
|
});
|
2016-03-30 17:33:02 +00:00
|
|
|
});
|