-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2abed04
commit b3d1c65
Showing
6 changed files
with
141 additions
and
33 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,60 @@ | ||
function attachFancybox(){var t=$(".fancybox-auto");t.each((function(t,o){o.id||(o.id="rndId-"+Math.floor(Math.random()*Math.floor(9999999)));var n=$(o).parent().attr("class");if(n){var a=n.split(" ").find((t=>t.startsWith("context")));a&&$(o).addClass(a)}})),t.click((function(){showDivWithSvg(this.id)}))}function showDivWithSvg(t){var o=t+"-clone",n=document.getElementById(o);n||((n=document.getElementById(t).cloneNode(!0)).id=o,n.style.width="95%",$(n).click((function(){$.fancybox.close()})),document.body.appendChild(n)),$.fancybox.open({src:"#"+o,type:"inline"})}$(document).ready((function(){$("img").not("#logo").not(".for-link").each((function(){var t=$(this);console.log("img",t);var o=t.attr("src");t.css("cursor","zoom-in"),t.css("cursor","-moz-zoom-in"),t.css("cursor","-webkit-zoom-in"),t.attr("alt",o),t.featherlight(o)}));const t=$(".version-button");t.attr("href",t.attr("href")+"?version=16.09&path="+window.location.pathname)})),$(attachFancybox); | ||
// Activate featherlite for quick lightboxes | ||
$(document).ready(function() { | ||
//find all images, but not the logo, and add the lightbox | ||
$('img').not('#logo').not('.for-link').each(function() { | ||
var $img = $(this); | ||
// debug | ||
console.log('img', $img); | ||
var filename = $img.attr('src') | ||
//add cursor | ||
$img.css('cursor','zoom-in'); | ||
$img.css('cursor','-moz-zoom-in'); | ||
$img.css('cursor','-webkit-zoom-in'); | ||
|
||
//add featherlight | ||
$img.attr('alt', filename); | ||
$img.featherlight(filename); | ||
}); | ||
|
||
// attach current link to the version box | ||
const vButton = $('.version-button'); | ||
vButton.attr('href', vButton.attr('href') + '?version=16.09&path=' + window.location.pathname); | ||
}); | ||
|
||
// Fancybox | ||
function attachFancybox() { | ||
var containers = $(".fancybox-auto"); | ||
// add ID if missing | ||
containers.each(function(i, e) { | ||
if(!e.id) e.id = 'rndId-' + Math.floor(Math.random() * Math.floor(9999999)) | ||
|
||
// check if we need to attach some classes from parent | ||
var pcls = $(e).parent().attr("class"); | ||
if(pcls) { | ||
var clsList = pcls.split(' '); | ||
var contextCls = clsList.find(c => c.startsWith('context')); | ||
if(contextCls) $(e).addClass(contextCls); | ||
} | ||
}); | ||
// attach click | ||
containers.click(function() { | ||
showDivWithSvg(this.id); | ||
}); | ||
} | ||
$(attachFancybox); | ||
|
||
function showDivWithSvg(target) { | ||
var newName = target + '-clone'; | ||
var clone = document.getElementById(newName); | ||
if(!clone) { | ||
clone = document.getElementById(target).cloneNode(true); | ||
clone.id = newName; | ||
clone.style.width = "95%"; | ||
$(clone).click(function() { $.fancybox.close() }) | ||
document.body.appendChild(clone); | ||
} | ||
$.fancybox.open( { | ||
src: '#' + newName, | ||
type: 'inline', | ||
}); | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters