3 Commits

Author SHA1 Message Date
38ff8cdc2c Update README.md 2021-03-10 19:25:16 +01:00
6ff2e56501 fixed image height & js formatting 2020-09-07 17:06:01 +02:00
cupcakearmy
331d47c9e9 update deps, fixed images and version bump 2020-09-03 11:31:22 +02:00
10 changed files with 1428 additions and 1653 deletions

3
.gitignore vendored
View File

@@ -9,4 +9,5 @@ node_modules/
# Generated
.cache/
liquet/dist/
liquet/dist/
liquet.zip

View File

@@ -2,6 +2,8 @@
A minimalistic and clean wordpress theme. Guteberg support out of the box.
> 🚨 Discontinued
## Required Plugins
- [Code Prettify](https://wordpress.org/plugins/code-prettify/)

View File

@@ -2,10 +2,10 @@
Theme Name: Liquet
Author: Niccolo Borgioli
Description: Minimalistic clean theme
Version: 0.15
Version: 0.17
License: MIT
Tags: minimal, simple, typography, clean
Author URI: https://nicco.io
License URI: https://opensource.org/licenses/MIT
Theme URI: https://github.com/cupcakearmy/liquet
*/
*/

View File

@@ -4,6 +4,11 @@
"dev": "parcel watch --no-hmr --no-source-maps -d liquet/dist ./src/js/index.js ./src/styles/index.styl",
"build": "rm -rf ./liquet/dist && parcel build --no-source-maps -d liquet/dist ./src/js/index.js ./src/styles/index.styl"
},
"browserslist": [
"last 2 chrome versions",
"last 2 safari versions",
"last 2 firefox versions"
],
"dependencies": {
"@swup/preload-plugin": "1.0.x",
"jquery": "^3.4.1",

View File

@@ -3,9 +3,9 @@ import lazy from './lazy'
import swup from './swup'
document.addEventListener('DOMContentLoaded', () => {
lights()
lights()
lazy()
swup(() => {
lazy()
swup(() => {
lazy()
})
})
})
})

View File

@@ -1,42 +1,39 @@
import $ from 'jquery'
export default () => {
const bottomOffset = 300
const app = document.getElementById('app')
let loading = false
let page = WPParams.lazy.current_page
const bottomOffset = 300
const app = document.getElementById('app')
let loading = false
let page = WPParams.lazy.current_page
function load() {
function load() {
const pixelToBottom = this.scrollHeight - (this.scrollTop + this.clientHeight)
const pixelToBottom = this.scrollHeight - (this.scrollTop + this.clientHeight)
if (!loading && pixelToBottom < bottomOffset) {
loading = true
if (!loading && pixelToBottom < bottomOffset) {
loading = true
$.ajax({
url: WPParams.lazy.ajaxurl,
data: {
name: window.location.pathname
.replace(/(\/\d+){3}\//, '')
.replace(/\/$/, ''),
action: 'lazy_load',
page,
},
type: 'POST',
success: (data) => {
if (data) {
$('#list').find('hr:last-of-type').after(data) // where to insert posts
page++
loading = false
}
}
})
}
$.ajax({
url: WPParams.lazy.ajaxurl,
data: {
name: window.location.pathname.replace(/(\/\d+){3}\//, '').replace(/\/$/, ''),
action: 'lazy_load',
page,
},
type: 'POST',
success: (data) => {
if (data) {
$('#list').find('hr:last-of-type').after(data) // where to insert posts
page++
loading = false
}
},
})
}
}
// Bind to the scroll event
$('#app').scroll(load)
// Bind to the scroll event
$('#app').scroll(load)
// Check initial page if they need loading
load.bind(app)()
}
// Check initial page if they need loading
load.bind(app)()
}

View File

@@ -1,30 +1,30 @@
export default () => {
// Lights
const key = 'nicco.io:blog:lights'
const CSS = 'body, .wp-block-image img, .thumbnail img {filter: invert(1);} '
const style = window.document.createElement('style')
document.head.appendChild(style)
// Lights
const key = 'nicco.io:blog:lights'
const CSS = 'body, .wp-block-image img, .thumbnail img {filter: invert(1);} '
const style = window.document.createElement('style')
document.head.appendChild(style)
const on = () => {
style.sheet.deleteRule(parseInt(window.localStorage.getItem(key)))
window.localStorage.removeItem(key)
}
const on = () => {
style.sheet.deleteRule(parseInt(window.localStorage.getItem(key)))
window.localStorage.removeItem(key)
}
const off = () => {
const i = style.sheet.insertRule(CSS)
window.localStorage.setItem(key, i)
}
const off = () => {
const i = style.sheet.insertRule(CSS)
window.localStorage.setItem(key, i)
}
const isDark = () => window.localStorage.getItem(key) !== null
const isDark = () => window.localStorage.getItem(key) !== null
if (isDark()) off()
if (isDark()) off()
window.toggleLights = () => isDark() ? on() : off()
window.toggleLights = () => (isDark() ? on() : off())
// Focus scrolling
document.addEventListener('DOMContentLoaded', () => {
const toFocus = document.querySelector('[data-focusme]')
toFocus.tabIndex = '1'
toFocus.focus({preventScroll: true})
})
}
// Focus scrolling
document.addEventListener('DOMContentLoaded', () => {
const toFocus = document.querySelector('[data-focusme]')
toFocus.tabIndex = '1'
toFocus.focus({ preventScroll: true })
})
}

View File

@@ -2,11 +2,11 @@ import Swup from 'swup'
import SwupPreloadPlugin from '@swup/preload-plugin'
export default (fn) => {
const swup = new Swup({
linkSelector: `a[href^="${window.location.origin}"]:not([data-no-swup]), a[href^="/"]:not([data-no-swup])`,
plugins: [new SwupPreloadPlugin()],
containers: ['#app']
})
const swup = new Swup({
linkSelector: `a[href^="${window.location.origin}"]:not([data-no-swup]), a[href^="/"]:not([data-no-swup])`,
plugins: [new SwupPreloadPlugin()],
containers: ['#app'],
})
swup.on('contentReplaced', fn)
swup.on('contentReplaced', fn)
}

View File

@@ -86,6 +86,10 @@
display: inline-block
font-size: 105%
figure
img
height: 100%
.links
& > div
transform rotate(180deg) scale(1)

2932
yarn.lock

File diff suppressed because it is too large Load Diff