obsidian-web/resources/js/main.js
2020-10-08 07:04:46 +01:00

34 lines
1.0 KiB
JavaScript

function updateURL( URL, Name) {
if (typeof history.pushState == 'function' ) {
var stateObj = { foo: "bar" };
history.pushState( stateObj, "Obsidian - " + Name, URL);
}
}
$("document").ready(function() {
$(".folder").click(function() {
$("#loading").show();
title = encodeURI($(this).children(".title").children("a").attr("href"));
Name = $(this).children(".title").children("a").html();
$("body").load(title, function( response, status, xhr ) {
if ( status == "error" ) {
var msg = "Sorry but there was an error: ";
$( "#error" ).html( msg + xhr.status + " " + xhr.statusText );
}});
updateURL(title, Name);
});
$(".thumb").click(function() {
title = encodeURI($(this).children("a").attr("href"));
$("#lightbox").html('<img src="' + title + '">');
$("#viewer").fadeIn();
return false;
});
$("#container").click(function() {
$("#viewer").fadeOut();
});
$(".loading").hide();
});