updates on 09.04

This commit is contained in:
infeeeee
2019-09-04 23:42:06 +02:00
parent 3553b6b0e0
commit 5d03dea44d
7 changed files with 1428 additions and 479 deletions

View File

@@ -17,12 +17,14 @@
// const wiw = window.innerWidth
// const bw = $('body').width()
// const woh = window.outerHeight
// // const woh = window.outerHeight
// const wih = window.innerHeight
// const vh = $(window).height()
// const boh = document.body.offsetHeight
// const dch = document.documentElement.clientHeight
// console.log('pixelratio:', window.devicePixelRatio)
const bottomScrollHeight = 0
// height of scrollbar at bottom
@@ -41,11 +43,11 @@
// w_wow: wow,
// w_wiw: wiw,
// w_bw: bw,
// desktophomemargin: desktophomemargin,
// // desktophomemargin: desktophomemargin,
// h_wih: wih,
// h_vh: vh,
// bottomScrollHeight: bottomScrollHeight,
// h_woh: woh,
// // bottomScrollHeight: bottomScrollHeight,
// // h_woh: woh,
// h_boh: boh,
// h_dch: dch
// }
@@ -151,22 +153,7 @@
}
}
/* --------------------- generic page load for onresize --------------------- */
function loadPage() {
if (isMobile) {
// hide social buttons
$('.social-link, .events-link').addClass('hidden')
// move search to menu
$(".search-box>.search-bar").prependTo("#sidebar-wrapper")
} else {
$('.social-link, .events-link').removeClass('hidden')
// move search to back
$("#sidebar-wrapper>.search-bar").appendTo(".search-box")
}
}
loadPage()
/* ========================================================================== */
/* SEARCH */
@@ -262,6 +249,54 @@
});
/* --------------------- generic page load for onresize --------------------- */
var articleWrapCounter = 0
function loadPage() {
if (isMobile) {
// hide social buttons
$('.social-link, .events-link').addClass('hidden')
// move search to menu
$(".search-box>.search-bar").prependTo("#sidebar-wrapper")
// set up no results
$('article.no-result').show()
$('body.no-result .archivetitle>h2').appendTo('article.no-result')
} else {
// not mobile
//show social links
$('.social-link, .events-link').removeClass('hidden')
// move search to back
$("#sidebar-wrapper>.search-bar").appendTo(".search-box")
// set up no results
$('article.no-result h2').appendTo('.archivetitle')
$('article.no-result').hide()
}
if (isMasonryPage) {
if (isMobile) {
//no overflowY
$('html').css({ overflowY: "unset" })
unWrapArts()
} else {
//no overflowY
$('html').css({ overflowY: "hidden" })
wrapArts()
$("body:not(.no-result) .archivetitle h1").fitText(0.7)
}
}
}
loadPage()
/* -------------------------------------------------------------------------- */
/* HOME & ARCHIVES */
/* -------------------------------------------------------------------------- */
@@ -272,80 +307,142 @@
if (isMasonryPage && $("article").hasClass('no-result')) {
$('body').addClass("no-result")
if (!isMobile) {
$('article.no-result h2').appendTo('.archivetitle')
$('article.no-result').hide()
}
// if (!isMobile) {
// $('article.no-result h2').appendTo('.archivetitle')
// $('article.no-result').hide()
// }
}
/* ----------------------------- css on desktop ----------------------------- */
/* ------------------------------ wrap articles ----------------------------- */
function wrapArts() {
//calculate wrappable elements
if ($(".hbox").length) {
return
}
$('#content>*:not(.misha_loadmore)').addClass("hbox")
var wrapArticles = $(".hbox").length
if (isHome) {
$('.hbox:first-child').wrap('<div class="home_wrapper-big home_wrapper-1"></div>').addClass("home-big")
$('.hbox:nth-child(2)').wrap('<div class="home_wrapper-big home_wrapper-2"></div>').addClass("home-big")
wrapArticles = $(".hbox").length - 2
}
//add classes to articles and elements
for (let i = 0; i < wrapArticles; i++) {
var j = i + 1
if (isHome) {
j = i + 3
}
if (i % 6 == 0) {
articleWrapCounter++
}
//console.log($('.hbox:nth-child(' + j + ')').attr("id"), i, j)
$('.hbox:nth-child(' + j + ')').addClass("home-small home-thumbnail-small-" + articleWrapCounter)
//change order if there is a description
if ($("body").is('.archive, .tag') && articleWrapCounter == 1) {
if (j == 3 || j == 4) {
$('.hbox:nth-child(' + j + ')').css({ order: j - 1 })
} else if (j == 5 || j == 6) {
$('.hbox:nth-child(' + j + ')').css({ order: j })
}
}
}
//wrap classes
for (let i = 0; i < articleWrapCounter; i++) {
var j = i + 1
if (isHome) {
j = i + 3
}
var k = i + 1
$(".home-thumbnail-small-" + k).wrapAll('<div class="home_wrapper-small home_wrapper-' + j + '"></div>')
if (i == 0) {
$(".home_wrapper-" + j).addClass("home_wrapper-s1")
}
}
}
function unWrapArts() {
$('.home_wrapper-big .hbox').unwrap('.home_wrapper-big')
var wrapArticles = $(".hbox").length
for (let i = 0; i < wrapArticles.length + 1; i++) {
$('article').removeClass('.home-thumbnail-small-' + i)
}
$('.hbox').removeClass('home-small').removeClass('hbox').unwrap('.home_wrapper-small')
}
if (!isMobile) {
if (isMasonryPage) {
//no overflowY
$('html').css({ overflowY: "hidden" })
//calculate wrappable elements
$('#content>*:not(.misha_loadmore)').addClass("hbox")
var wrapArticles = $(".hbox").length
//wrapping for big-small difference
if (isHome) {
$('.hbox:first-child').wrap('<div class="home_wrapper-big home_wrapper-1"></div>').addClass("home-big")
$('.hbox:nth-child(2)').wrap('<div class="home_wrapper-big home_wrapper-2"></div>').addClass("home-big")
wrapArticles = $(".hbox").length - 2
}
// //calculate wrappable elements
// $('#content>*:not(.misha_loadmore)').addClass("hbox")
// var wrapArticles = $(".hbox").length
//add classes to articles and elements
var articleWrapCounter = 0
for (let i = 0; i < wrapArticles; i++) {
var j = i + 1
// //wrapping for big-small difference
// if (isHome) {
// $('.hbox:first-child').wrap('<div class="home_wrapper-big home_wrapper-1"></div>').addClass("home-big")
// $('.hbox:nth-child(2)').wrap('<div class="home_wrapper-big home_wrapper-2"></div>').addClass("home-big")
// wrapArticles = $(".hbox").length - 2
// }
if (isHome) {
j = i + 3
}
// //add classes to articles and elements
// var articleWrapCounter = 0
// for (let i = 0; i < wrapArticles; i++) {
// var j = i + 1
if (i % 6 == 0) {
articleWrapCounter++
}
//console.log($('.hbox:nth-child(' + j + ')').attr("id"), i, j)
$('.hbox:nth-child(' + j + ')').addClass("home-small home-thumbnail-small-" + articleWrapCounter)
//change order if there is a description
if ($("body").is('.archive, .tag') && articleWrapCounter == 1) {
if (j == 3 || j == 4) {
$('.hbox:nth-child(' + j + ')').css({ order: j - 1 })
} else if (j == 5 || j == 6) {
$('.hbox:nth-child(' + j + ')').css({ order: j })
}
// if (isHome) {
// j = i + 3
// }
}
}
//wrap classes
for (let i = 0; i < articleWrapCounter; i++) {
var j = i + 1
if (isHome) {
j = i + 3
}
var k = i + 1
$(".home-thumbnail-small-" + k).wrapAll('<div class="home_wrapper-small home_wrapper-' + j + '"></div>')
if (i == 0) {
$(".home_wrapper-" + j).addClass("home_wrapper-s1")
}
}
// if (i % 6 == 0) {
// articleWrapCounter++
// }
// //console.log($('.hbox:nth-child(' + j + ')').attr("id"), i, j)
// $('.hbox:nth-child(' + j + ')').addClass("home-small home-thumbnail-small-" + articleWrapCounter)
// //change order if there is a description
// if ($("body").is('.archive, .tag') && articleWrapCounter == 1) {
// if (j == 3 || j == 4) {
// $('.hbox:nth-child(' + j + ')').css({ order: j - 1 })
// } else if (j == 5 || j == 6) {
// $('.hbox:nth-child(' + j + ')').css({ order: j })
// }
// }
// }
// //wrap classes
// for (let i = 0; i < articleWrapCounter; i++) {
// var j = i + 1
// if (isHome) {
// j = i + 3
// }
// var k = i + 1
// $(".home-thumbnail-small-" + k).wrapAll('<div class="home_wrapper-small home_wrapper-' + j + '"></div>')
// if (i == 0) {
// $(".home_wrapper-" + j).addClass("home_wrapper-s1")
// }
// }
/* -------------------------------- other css ------------------------------- */
//add bottom scrollbar to div on bottom:
if (bottomScrollHeight > 0) {
$(".home_wrapper-big .metadata").css({ bottom: bottomScrollHeight })
}
// if (bottomScrollHeight > 0) {
// $(".home_wrapper-big .metadata").css({ bottom: bottomScrollHeight })
// }
//fit title
$("body:not(.no-result) .archivetitle h1").fitText(0.7)
// $("body:not(.no-result) .archivetitle h1").fitText(0.7)
}//isMasonryPage end
}// !isMobile end
@@ -597,7 +694,7 @@
return
} else {
if (!isMobile) {
if (isMasonryPage) {
if (isMasonryPage || isEsemeny) {
if (!$('.search-bar *').is(':focus')) {
// console.log("keydown!")
kd = true
@@ -629,7 +726,7 @@
//check for keyup for disabling counter
$('html *:not(input)').keyup(function (event) {
if (!isMobile) {
if (isMasonryPage) {
if (isMasonryPage || isEsemeny) {
if (!$('.search-bar *').is(':focus')) {
kd = false
}
@@ -1077,6 +1174,12 @@
swipeRight: function () {
$.colorbox.prev()
},
swipeUp: function () {
return false
},
swipeDown: function () {
return false
},
})
// lightbox for galleries
@@ -1133,6 +1236,12 @@
}//if single end
/* ------------------------------- IOS fix try ------------------------------ */
// $(".logo a").click(function(e){
// e.preventDefault()
// alert('hello')
// })
/* -------------------------------------------------------------------------- */
/* window resize event */