This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.onLeave = (f, single = false) => { | |
var showed = false | |
var fn = () => { | |
if (single ? !showed : true) { | |
if (single) showed = true; | |
f() | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Remove the slug from published post permalinks for our custom post types. | |
*/ | |
add_filter( 'post_type_link', function( $post_link, $post, $leavename ) { | |
$post_types = array( | |
'projects', | |
'catalog', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var showed = false | |
window.addEventListener('mouseout', e => { | |
if (!showed && (e.pageX < 1 || e.pageY < 1)) { | |
showed = true | |
// | |
} | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
backdrop-filter: blur(20px) | |
box-shadow: 0 1px 24px -1px rgba(#fff, .1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@import '../node_modules/swiper/swiper.scss' | |
@import '../node_modules/swiper/components/navigation/navigation.scss' | |
// @import '../node_modules/swiper/components/pagination/pagination.scss' | |
// @import '../node_modules/swiper/components/lazy/lazy.scss' | |
import SwiperCore, { Navigation } from 'swiper'; share(SwiperCore, 'Swiper') | |
Swiper.use([Navigation]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Object.keys((new $).__proto__).forEach(el => { | |
try { | |
if (!HTMLElement.prototype[el]) { | |
HTMLElement.prototype[el] = function() { | |
let e = $(this) | |
return e[el].apply(e, arguments) | |
} | |
} | |
} catch(e) {} | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DB::getPdo()->lastInsertId(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// https://forums.modx.com/thread/74440/problem-with-creating-modresource-programmatically | |
$page = $modx->newObject('modResource'); | |
$page->set('createdby', $modx->user->id); | |
$page->set('createdon', time()); | |
$page->set('parent', 3); | |
$page->set('template', $templateId); | |
$page->set('alias', $page->cleanAlias($rq['pagetitle'])); | |
// $page->set('uri', $page->cleanAlias($rq['pagetitle']).".html"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.stick = (el, top_el = null, bottom_el = null) => { | |
var parent = el.parentNode | |
if (!top_el) top_el = parent | |
if (!bottom_el) bottom_el = parent | |
window.addEventListener('scroll', debounce(() => { | |
var top = window.pageYOffset | |
var bottom_stop = $(bottom_el).offset().top | |
var top_stop = $(top_el).offset().top |