error, no result pages
This commit is contained in:
154
js/scripts.js
154
js/scripts.js
@@ -60,7 +60,7 @@
|
||||
}
|
||||
})()
|
||||
|
||||
const isTablet = (!isMobile && (wow < 1024 || wiw < 1024)) ? true : false
|
||||
const isTablet = (!isMobile && (wow < 1024 && wiw < 1024)) ? true : false
|
||||
|
||||
/**
|
||||
* Checks if body has a class
|
||||
@@ -93,6 +93,9 @@
|
||||
//isSearch
|
||||
const isSearch = bodyHasClass('search-results')
|
||||
|
||||
//isSearchNoResults
|
||||
const isSearchNoResults = bodyHasClass('search-no-results')
|
||||
|
||||
//isEsemeny
|
||||
const isEsemeny = bodyHasClass('category-esemeny')
|
||||
|
||||
@@ -100,7 +103,7 @@
|
||||
const isSingle = bodyHasClass('single')
|
||||
|
||||
// Masonrypage: archive, home or search results
|
||||
var isMasonryPage = isArchive || isHome || isSearch
|
||||
var isMasonryPage = isArchive || isHome || isSearch || isSearchNoResults
|
||||
|
||||
|
||||
/* ========================================================================== */
|
||||
@@ -164,12 +167,13 @@
|
||||
/* ========================================================================== */
|
||||
|
||||
var menuWidth = wow
|
||||
if (!isMobile) {
|
||||
menuWidth = 500
|
||||
}
|
||||
|
||||
if (isTablet) {
|
||||
menuWidth = 350
|
||||
}
|
||||
if (!isMobile && !isTablet) {
|
||||
menuWidth = 500
|
||||
}
|
||||
|
||||
$("#sidebar").simplerSidebar({
|
||||
|
||||
@@ -212,9 +216,22 @@
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
/* ------------------------------- no results ------------------------------- */
|
||||
|
||||
|
||||
if (isMasonryPage && $("article").hasClass('no-result')) {
|
||||
$('body').addClass("no-result")
|
||||
if (!isMobile) {
|
||||
$('article.no-result h2').appendTo('.archivetitle')
|
||||
$('article.no-result').hide()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* ----------------------------- css on desktop ----------------------------- */
|
||||
|
||||
/* ------------------------------ wrap articles ----------------------------- */
|
||||
|
||||
if (!isMobile) {
|
||||
if (isMasonryPage) {
|
||||
//no overflowY
|
||||
@@ -268,6 +285,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------- other css ------------------------------- */
|
||||
|
||||
//add bottom scrollbar to div on bottom:
|
||||
if (bottomScrollHeight > 0) {
|
||||
$(".home_wrapper-big .metadata").css({ bottom: bottomScrollHeight })
|
||||
@@ -276,12 +295,17 @@
|
||||
}
|
||||
|
||||
//fit title
|
||||
$(".archivetitle h1").fitText(0.6)
|
||||
$("body:not(.no-result) .archivetitle h1").fitText(0.7)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}//isMasonryPage end
|
||||
}// !isMobile end
|
||||
|
||||
/* ----------------------------- random cutouts ----------------------------- */
|
||||
|
||||
function random2() {
|
||||
const choices = [
|
||||
[1, 3],
|
||||
@@ -332,6 +356,12 @@
|
||||
$('html, body').stop().animate({ scrollTop: 0 }, 800);
|
||||
})
|
||||
|
||||
//hide totop if not needed
|
||||
if (!($("main").height() > $(window).height()) && isMobile) {
|
||||
$(".totop").hide()
|
||||
}
|
||||
|
||||
|
||||
/* ---------------------------- Scroll on desktop --------------------------- */
|
||||
|
||||
/**
|
||||
@@ -607,16 +637,18 @@
|
||||
},
|
||||
success: function (data) {
|
||||
if (data) {
|
||||
if (data.length < 100) {
|
||||
if (data.length < 102) {
|
||||
button.children().remove(); // if last page, remove the button
|
||||
noMoreAjax = true
|
||||
return false
|
||||
}
|
||||
|
||||
// console.log(data.length)
|
||||
|
||||
button.html('<a>Mutass többet</a>').before(data); // insert new posts
|
||||
misha_loadmore_params.current_page++;
|
||||
button.trigger("moreload-finish", scroll)
|
||||
console.log("loading:", data.length)
|
||||
// console.log("loading:", data.length)
|
||||
|
||||
// you can also fire the "post-load" event here if you use a plugin that requires it
|
||||
// $( document.body ).trigger( 'post-load' );
|
||||
@@ -624,7 +656,7 @@
|
||||
} else {
|
||||
button.children().remove(); // if no data, remove the button as well
|
||||
noMoreAjax = true
|
||||
console.log("no data")
|
||||
// console.log("no data")
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -639,17 +671,34 @@
|
||||
|
||||
/* ------------------------------ hover on home ----------------------------- */
|
||||
|
||||
var bigMetadataHeight
|
||||
var defaultMetadataHeight
|
||||
var openedMetadataHeight
|
||||
|
||||
//hover on big articles
|
||||
$(".home-big h2 a").hover(function () {
|
||||
let cc = $(this)
|
||||
let cArticle = cc.parents("article")
|
||||
let cMetadata = cArticle.children(".metadata")
|
||||
if (!bigMetadataHeight) {
|
||||
bigMetadataHeight = cMetadata[0].getBoundingClientRect().height
|
||||
let cBevezeto = cMetadata.children(".bevezeto")[0]
|
||||
|
||||
// calculate default height
|
||||
if (!defaultMetadataHeight) {
|
||||
defaultMetadataHeight = cMetadata[0].getBoundingClientRect().height
|
||||
}
|
||||
|
||||
//calculate opened height
|
||||
if (!openedMetadataHeight) {
|
||||
let h2H = 0
|
||||
$(".home-big h2").each(function () {
|
||||
if ($(this)[0].getBoundingClientRect().height > h2H) {
|
||||
h2H = $(this)[0].getBoundingClientRect().height
|
||||
}
|
||||
})
|
||||
let artH = cArticle[0].getBoundingClientRect().height
|
||||
openedMetadataHeight = artH - bottomScrollHeight - h2H
|
||||
// $('.alcim').css({width: openedMetadataHeight})
|
||||
$('.bevezeto').css({height: openedMetadataHeight})
|
||||
}
|
||||
|
||||
//add hovered class
|
||||
cArticle.addClass("hovered")
|
||||
@@ -663,10 +712,13 @@
|
||||
cMetadata.children(".categories, .postedon").addClass("transparent")
|
||||
|
||||
//animate border
|
||||
cMetadata.stop().animate({ height: "25rem" }, 400, _ => {
|
||||
cMetadata.stop().animate({ height: openedMetadataHeight }, 400, _ => {
|
||||
//hide metadata
|
||||
cMetadata.children(".categories, .postedon").hide().removeClass("transparent")
|
||||
cMetadata.children(".alcim, .bevezeto").show().removeClass("transparent")
|
||||
|
||||
//clamp bevezető
|
||||
$clamp(cBevezeto, { clamp: 'auto' });
|
||||
})
|
||||
|
||||
|
||||
@@ -687,14 +739,65 @@
|
||||
cMetadata.children(".alcim, .bevezeto").addClass("transparent")
|
||||
|
||||
//animate height change
|
||||
cMetadata.stop().animate({ height: bigMetadataHeight }, 400, _ => {
|
||||
cMetadata.stop().animate({ height: defaultMetadataHeight }, 400, _ => {
|
||||
//hide and show metadata
|
||||
cMetadata.children(".alcim, .bevezeto").hide().removeClass("transparent")
|
||||
cMetadata.children(".categories, .postedon").removeClass("transparent").show()
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
|
||||
// for testing:
|
||||
var bighovertest = (function () {
|
||||
let cc = $(".home_wrapper-1 .home-big h2 a")
|
||||
let cArticle = cc.parents("article")
|
||||
let cMetadata = cArticle.children(".metadata")
|
||||
let cBevezeto = cMetadata.children(".bevezeto")[0]
|
||||
|
||||
// calculate default height
|
||||
if (!defaultMetadataHeight) {
|
||||
defaultMetadataHeight = cMetadata[0].getBoundingClientRect().height
|
||||
}
|
||||
|
||||
//calculate opened height
|
||||
if (!openedMetadataHeight) {
|
||||
let h2H = 0
|
||||
$(".home-big h2").each(function () {
|
||||
if ($(this)[0].getBoundingClientRect().height > h2H) {
|
||||
h2H = $(this)[0].getBoundingClientRect().height
|
||||
}
|
||||
})
|
||||
let artH = cArticle[0].getBoundingClientRect().height
|
||||
openedMetadataHeight = artH - bottomScrollHeight - h2H
|
||||
// cMetadata.children('.alcim').css({width: openedMetadataHeight})
|
||||
$('.bevezeto').css({height: openedMetadataHeight})
|
||||
}
|
||||
|
||||
|
||||
|
||||
//add hovered class
|
||||
cArticle.addClass("hovered")
|
||||
|
||||
//add tag to header for bg
|
||||
let artClasses = cArticle.attr("class").split(" ")
|
||||
let theTag = findClassByStart(artClasses, "tag")
|
||||
$("body, .header-1, .header-2").addClass("hover-" + theTag)
|
||||
|
||||
//transparent metadata
|
||||
cMetadata.children(".categories, .postedon").addClass("transparent")
|
||||
|
||||
//animate border
|
||||
cMetadata.stop().animate({ height: openedMetadataHeight }, 400, _ => {
|
||||
//hide metadata
|
||||
cMetadata.children(".categories, .postedon").hide().removeClass("transparent")
|
||||
cMetadata.children(".alcim, .bevezeto").show().removeClass("transparent")
|
||||
|
||||
//clamp bevezető
|
||||
$clamp(cBevezeto, { clamp: 'auto' });
|
||||
})
|
||||
})()
|
||||
|
||||
|
||||
/**
|
||||
* finds a name of a class, from the first element
|
||||
* @param {Array} classlist the list of classes to search from as an array
|
||||
@@ -714,13 +817,19 @@
|
||||
|
||||
//hover on small articles
|
||||
function showTitle(th) {
|
||||
$(th).children("h2").show()
|
||||
$(th).children(".metadata").addClass("vis")
|
||||
if (!$('body').hasClass('no-result')) {
|
||||
$(th).children("h2").show()
|
||||
$(th).children(".metadata").addClass("vis")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function hideTitle(th) {
|
||||
$(th).children("h2").hide()
|
||||
$(th).children(".metadata").removeClass("vis")
|
||||
if (!$('body').hasClass('no-result')) {
|
||||
$(th).children("h2").hide()
|
||||
$(th).children(".metadata").removeClass("vis")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$(document).on({
|
||||
@@ -752,13 +861,6 @@
|
||||
}, ".home-small a.thumbnailwrapper")
|
||||
|
||||
|
||||
/* ------------------------------- no results ------------------------------- */
|
||||
|
||||
|
||||
if (isMasonryPage && $("article").hasClass('no-result')) {
|
||||
$('body').addClass("no-result")
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* EVENTS - ESEMÉNYEK */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
Reference in New Issue
Block a user