71 lines
2.2 KiB
JavaScript
71 lines
2.2 KiB
JavaScript
|
|
$(document).ready(function() {
|
|
jQuery('a.thumbnail').colorbox({rel:'gal'});
|
|
jQuery('a.gallery_image').colorbox({rel:'gal'});
|
|
jQuery(".youtube").colorbox({iframe:true, innerWidth:'75%', innerHeight:'75%'});
|
|
|
|
jQuery(".font-icon").click(function (){
|
|
jQuery("body").toggleClass("dark-mode");
|
|
if(getCookie("dark-mode") === "true") {
|
|
setCookie("dark-mode", "false", 365);
|
|
}
|
|
else {
|
|
setCookie("dark-mode", "true", 365);
|
|
}
|
|
});
|
|
|
|
if(getCookie("dark-mode") === "true") {
|
|
jQuery("body").toggleClass("dark-mode");
|
|
}
|
|
|
|
if(window.innerWidth >= 1920) {
|
|
|
|
// $("img.scaled-image").each(function(idx, elm){
|
|
// $(elm).css("margin-bottom", elm.height * -0.333);
|
|
// }).on("load", function(e){
|
|
// $(e.target).css("margin-bottom", e.target.height * -0.333);
|
|
// });
|
|
$("a.colorbox-inline").each(function(idx, elm){
|
|
let child = $(elm).children("img")[0];
|
|
let w = (child.naturalWidth * 0.666) + 1
|
|
let h = (child.naturalHeight * 0.666) + 1
|
|
$(elm).colorbox({inline: true, innerWidth: w, innerHeight: h, scrolling: false});
|
|
});
|
|
}
|
|
else {
|
|
jQuery("a.colorbox-inline").colorbox({inline:true});
|
|
}
|
|
$(".back-button")
|
|
.html("Go Back")
|
|
.click(function(_) { window.history.back()});
|
|
|
|
if(navigator.userAgent.indexOf("Trident") > -1) {
|
|
console.log(navigator.userAgent);
|
|
$(".search-icon").css("display", "none");
|
|
}
|
|
|
|
|
|
});
|
|
|
|
function setCookie(cname, cvalue, exdays) {
|
|
var d = new Date();
|
|
d.setTime(d.getTime() + (exdays*24*60*60*1000));
|
|
var expires = "expires="+ d.toUTCString();
|
|
document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
|
|
}
|
|
|
|
function getCookie(cname) {
|
|
var name = cname + "=";
|
|
var decodedCookie = decodeURIComponent(document.cookie);
|
|
var ca = decodedCookie.split(';');
|
|
for(var i = 0; i <ca.length; i++) {
|
|
var c = ca[i];
|
|
while (c.charAt(0) == ' ') {
|
|
c = c.substring(1);
|
|
}
|
|
if (c.indexOf(name) == 0) {
|
|
return c.substring(name.length, c.length);
|
|
}
|
|
}
|
|
return "";
|
|
} |