Skip to content

Instantly share code, notes, and snippets.

Avatar

IgorGavrilenko

View GitHub Profile
View новый элемент
// insertedInit
$(insertedInit);
function uOrderInitInit(){
var $parent = $('.parent');
var $el = '.el';
$parent.on("DOMNodeInserted", function (event) {
$(event.target).find($el).addClass();
});
};
View main.js
// uOrderInitInit
$(uOrderInitInit);
function uOrderInitInit(){
var $filterOutput = $('.filter-output');
var $uOrder = $('.table-u-order__hint');
var $uOrderEl = '.table-u-order__hint';
var $uOrderParent = 'td';
var $uOrderParentClass = 'table-u-order';
if ($uOrder.length) {
$uOrder.parent($uOrderParent).addClass($uOrderParentClass);
@IgorGavrilenko
IgorGavrilenko / php класс для текущей стр
Created Oct 21, 2020
php класс для текущей стр
View php класс для текущей стр
<?php
list($class) = explode('?', $_SERVER['REQUEST_URI']);
$class = str_replace(array('/', '.php'), '', $class);
?>
<?php echo $class ?>
View resetForms
var resetForms = function() {
for (i = 0; i < $jsForm.length; i++) {
$jsForm[i].reset();
}
}
resetForms();
View observer
const el = document.querySelector(".myElement")
const observer = new IntersectionObserver(
([e]) => e.target.classList.toggle("is-pinned", e.intersectionRatio < 1),
{ threshold: [1] }
);
observer.observe(el);
View empty or not
$('.el').each(function () {
if($.trim($(this).html())==='') {
$(this).detach();
}
else {
$(this).addClass();
}
});
View DOMNodeInserted
if ($('.el').length) {
}
$('.parent').on("DOMNodeInserted", function (event) {
$(event.target).find('.el').addClass('is-el');
});
View .htpasswd
AuthGroupFile /dev/null
AuthType Basic
AuthUserFile /home/name/domains/newcardplace-html.informbox.ru/.htpasswd/public_html/.htpasswd
AuthName "Member's Area"
require valid-user
ErrorDocument 401 "Unauthorized Access"
Options +FollowSymLinks -SymLinksIfOwnerMatch
View media jquery
var $mql = window.matchMedia('(min-width: 992px)');
var handleMQL = function ($mql) {
if ($mql.matches) {
} else {
}
};
handleMQL($mql);
$mql.addListener(handleMQL);
View resize
$(window).resize(function() {
}).trigger("resize");