working on responsivity

This commit is contained in:
infeeeee
2019-08-13 04:34:46 +02:00
parent 0686d99971
commit 6edb7e59ed
10 changed files with 1514 additions and 855 deletions

12
js/lib/clamp.min.js vendored Normal file
View File

@@ -0,0 +1,12 @@
/*!
* Clamp.js 0.5.1
*
* Copyright 2011-2013, Joseph Schmitt http://joe.sh
* Released under the WTFPL license
* http://sam.zoy.org/wtfpl/
*/
(function(){window.$clamp=function(c,d){function s(a,b){n.getComputedStyle||(n.getComputedStyle=function(a,b){this.el=a;this.getPropertyValue=function(b){var c=/(\-([a-z]){1})/g;"float"==b&&(b="styleFloat");c.test(b)&&(b=b.replace(c,function(a,b,c){return c.toUpperCase()}));return a.currentStyle&&a.currentStyle[b]?a.currentStyle[b]:null};return this});return n.getComputedStyle(a,null).getPropertyValue(b)}function t(a){a=a||c.clientHeight;var b=u(c);return Math.max(Math.floor(a/b),0)}function x(a){return u(c)*
a}function u(a){var b=s(a,"line-height");"normal"==b&&(b=1.2*parseInt(s(a,"font-size")));return parseInt(b)}function l(a){if(a.lastChild.children&&0<a.lastChild.children.length)return l(Array.prototype.slice.call(a.children).pop());if(a.lastChild&&a.lastChild.nodeValue&&""!=a.lastChild.nodeValue&&a.lastChild.nodeValue!=b.truncationChar)return a.lastChild;a.lastChild.parentNode.removeChild(a.lastChild);return l(c)}function p(a,d){if(d){var e=a.nodeValue.replace(b.truncationChar,"");f||(h=0<k.length?
k.shift():"",f=e.split(h));1<f.length?(q=f.pop(),r(a,f.join(h))):f=null;m&&(a.nodeValue=a.nodeValue.replace(b.truncationChar,""),c.innerHTML=a.nodeValue+" "+m.innerHTML+b.truncationChar);if(f){if(c.clientHeight<=d)if(0<=k.length&&""!=h)r(a,f.join(h)+h+q),f=null;else return c.innerHTML}else""==h&&(r(a,""),a=l(c),k=b.splitOnChars.slice(0),h=k[0],q=f=null);if(b.animate)setTimeout(function(){p(a,d)},!0===b.animate?10:b.animate);else return p(a,d)}}function r(a,c){a.nodeValue=c+b.truncationChar}d=d||{};
var n=window,b={clamp:d.clamp||2,useNativeClamp:"undefined"!=typeof d.useNativeClamp?d.useNativeClamp:!0,splitOnChars:d.splitOnChars||[".","-","\u2013","\u2014"," "],animate:d.animate||!1,truncationChar:d.truncationChar||"\u2026",truncationHTML:d.truncationHTML},e=c.style,y=c.innerHTML,z="undefined"!=typeof c.style.webkitLineClamp,g=b.clamp,v=g.indexOf&&(-1<g.indexOf("px")||-1<g.indexOf("em")),m;b.truncationHTML&&(m=document.createElement("span"),m.innerHTML=b.truncationHTML);var k=b.splitOnChars.slice(0),
h=k[0],f,q;"auto"==g?g=t():v&&(g=t(parseInt(g)));var w;z&&b.useNativeClamp?(e.overflow="hidden",e.textOverflow="ellipsis",e.webkitBoxOrient="vertical",e.display="-webkit-box",e.webkitLineClamp=g,v&&(e.height=b.clamp+"px")):(e=x(g),e<=c.clientHeight&&(w=p(l(c),e)));return{original:y,clamped:w}}})();

View File

@@ -23,6 +23,7 @@
const desktophomemargin = $(".header-1")[0].getBoundingClientRect().width
// height of scrollbar at bottom
const bottomScrollHeight = (_ => {
if (wih / vh > 1.5) {
@@ -43,7 +44,7 @@
vh: vh,
bottomScrollHeight: bottomScrollHeight
}
//console.log(cssWidths)
console.log(cssWidths)
/* --------------------------- css values to vars --------------------------- */
@@ -59,6 +60,8 @@
}
})()
const isTablet = (!isMobile && (wow < 1024 || wiw < 1024)) ? true : false
/**
* Checks if body has a class
* @param {string} classname The class to check
@@ -96,11 +99,10 @@
//isSingle
const isSingle = bodyHasClass('single')
// Masonrypage: archive, home or search results
var isMasonryPage = isArchive || isHome || isSearch
/* ========================================================================== */
/* FUNCTIONS */
/* ========================================================================== */
@@ -147,7 +149,7 @@
})
} else {
//if it's closed open:
bar.show().stop().animate({ width: wiw - (desktophomemargin * 3) }, 400, function () {
bar.show().stop().animate({ width: wiw - (desktophomemargin * 2) }, 400, function () {
bar.addClass("opensearch")
$(".search-input").focus()
})
@@ -165,6 +167,9 @@
if (!isMobile) {
menuWidth = 500
}
if (isTablet) {
menuWidth = 350
}
$("#sidebar").simplerSidebar({
@@ -207,8 +212,8 @@
/* -------------------------------------------------------------------------- */
/* ----------------------------------- css ---------------------------------- */
/* ----------------------------- css on desktop ----------------------------- */
if (!isMobile) {
if (isMasonryPage) {
@@ -634,11 +639,17 @@
/* ------------------------------ hover on home ----------------------------- */
var bigMetadataHeight
//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
}
//add hovered class
cArticle.addClass("hovered")
@@ -676,7 +687,7 @@
cMetadata.children(".alcim, .bevezeto").addClass("transparent")
//animate height change
cMetadata.stop().animate({ height: "10rem" }, 400, _ => {
cMetadata.stop().animate({ height: bigMetadataHeight }, 400, _ => {
//hide and show metadata
cMetadata.children(".alcim, .bevezeto").hide().removeClass("transparent")
cMetadata.children(".categories, .postedon").removeClass("transparent").show()
@@ -741,6 +752,13 @@
}, ".home-small a.thumbnailwrapper")
/* ------------------------------- no results ------------------------------- */
if (isMasonryPage && $("article").hasClass('no-result')) {
$('body').addClass("no-result")
}
/* -------------------------------------------------------------------------- */
/* EVENTS - ESEMÉNYEK */
/* -------------------------------------------------------------------------- */
@@ -818,6 +836,12 @@
if (isSingle) {
/* ---------------------------- wrap figcaptions --------------------------- */
$("figcaption").wrapInner("<span></span>")
/* ----------------------------- images, gallery ---------------------------- */
@@ -880,15 +904,18 @@
/* ---------------------------- hover and click on related ---------------------------- */
$(document).on({
mouseenter: function () {
if (!Modernizr.touchevents) {
showTitle(this)
let wrapper = $(this).children(".relatedWrapper")
showTitle(wrapper)
}
},
mouseleave: function () {
if (!Modernizr.touchevents) {
hideTitle(this)
let wrapper = $(this).children(".relatedWrapper")
hideTitle(wrapper)
}
}
}, '#related_posts li');
@@ -897,19 +924,15 @@
$(document).on({
'touchend': function (e) {
e.preventDefault()
var art = $(this).parents("li")
var metadata = art.children(".metadata")
if (metadata.hasClass("vis")) {
hideTitle(art)
} else {
hideTitle($(".vis").parents("li"))
showTitle(art)
}
var art = $(this).parents("li").children(".relatedWrapper")
hideTitle($(".vis").parents(".relatedWrapper"))
showTitle(art)
}
}, "#related_posts li a.related_thumbnailwrapper")
//click on related
$('#related_posts li').click(function () {
$('#related_posts li .relatedWrapper').click(function () {
let href = $(this).children('a.related_thumbnailwrapper').attr("href")
window.open(href, "_self")
})