server {
listen 443 ssl;
ssl_certificate /etc/ssl/certificate.crt;
ssl_certificate_key /etc/ssl/private.key;
server_name alltech.home.com;
location /v1/doit/completions {
proxy_ssl_server_name on;
proxy_pass https://api.open.my/v1/doit/completions;
}
location / {
root /usr/share/nginx/html/;
autoindex off;
}
}
document.addEventListener( 'wpcf7mailsent', function( event ) {
location = 'https://site.com/thanks';
setTimeout(() => window.open('https://site.com/thanks2', "_blank"))
}, false );
.header__wrap{
min-height: 500px;
display: flex;
flex-direction: column;
}
.header__content{
flex: 1 1 0;
}
const arr = [
{
"name": "Грузинская ж. д.",
"Щебень гранитный не поименованный в алфавите": {
"amount": 275,
"stavka": 0,
"revenue": 0
}
},
{
"name": "Московская ж. д.",
"Щебень гранитный не поименованный в алфавите": {
"amount": 138,
"stavka": 0,
"revenue": 0
}
}
]
console.log(arr.map(n => ({ name: n.name, ...Object.values(n)[1] }) ))
Но когда я дописываю скрипт на проверку пагинации, он не работает
function is_paged() {
return window.location.pathname.split("/").includes('page')
}
какой код для фильтра писать, чтобы добавлялся класс я не знаю.
function isFilter(){
return window.location.pathname.split("/").some(n => n.split('=').includes('?filter_type_test'))
}
MutationObserver
const subtract = (v1, v2) => ({
x: v1.x - v2.x,
y: v1.y - v2.y
});
const magnitude = ({ x, y }) => Math.sqrt(x * x + y * y);
const pointDistance = (point1, point2) => magnitude(subtract(point1, point2));
const curveLength = (points) => {
let lastPoint = points[0];
const pointsSansFirst = points.slice(1);
return pointsSansFirst.reduce((acc, point) => {
const dist = pointDistance(point, lastPoint);
lastPoint = point;
return acc + dist;
}, 0);
};
$(document).on('change', 'input.variable_manage_stock', function (event) {
const variation = event.target.closest('.woocommerce_variation');
const checkbox = event.target;
const checkbox_on_off = checkbox.matches('input.variable_manage_stock:checked') && checkbox.value;
if (checkbox_on_off == 'on' && variation){}
if (checkbox_on_off == 'false'){}
});
let n = 0;
const interval = setInterval(() => {
if(n == 5){
clearInterval(interval);
return;
}
++n;
let t = n;
console.log(`вызов setInterval № ${t} спустя ${100}мс`)
setTimeout(() => {
console.log(`вызов setTimeout № ${t} спустя ${5000}мс`)
}, 5000)
}, 100)
const deleteBaggagePrice = price = price.filter( //проверка price на наличие свойства baggageID
(prop) => !prop.hasOwnProperty("baggageID") //если есь удалить объект
);
const nodemailer = require("nodemailer");
const { google } = require("googleapis");
const OAuth2 = google.auth.OAuth2;
const OAuth2_client = new OAuth2(clientId, client_secret);
OAuth2_client.setCredentials({ refresh_token: refresGoogleToken });
class MailService {
static async sendActivationMail(to, activationLink) {
const accessToken = await OAuth2_client.getAccessToken();
const transporter = nodemailer.createTransport({
service: "gmail",
secure: false,
auth: {
type: "OAuth2",
user: email,
clientId: clientId,
clientSecret: client_secret,
refreshToken: refresGoogleToken,
accessToken: accessToken,
},
tls: {
rejectUnauthorized: false,
},
});
await transporter.sendMail({
from: email,
to,
// и тут ниже остальная логика по созданию содержимого сообщения для почты, тут ничего ниже особенного нет
<div class="wrapper">
<div class="piechart"></div>
</div>
.wrapper{
border: 2px solid green;
display: inline-flex;
}
.piechart{
display: flex;
justify-content: center;
align-items: center;
position: relative;
width: 18rem;
height: 18rem;
border-radius: 50%;
background: conic-gradient(#fff 0 25deg, red 0 65deg, #fff 0 270deg);
}
.piechart:after{
content: '';
width: 85%;
height: 85%;
background: #fff;
border-radius: 50%;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
<canvas width="1000px" height="1000px"></canvas>
const canvas = document.querySelector('canvas')
const ctx = canvas.getContext('2d');
const drawRect = (color, x, y, width, height) => {
ctx.fillStyle = color;
ctx.fillRect(x, y, width, height);
return {
color, x, y, width, height
}
}
drawRect('blue', 50, 50, 20, 20)
drawRect('black', 150, 150, 50, 150)
const drawLine = (x1,y1,x2,y2) => {
ctx.lineWidth = '3';
ctx.strokeStyle = 'violet';
ctx.beginPath();
ctx.moveTo(x1,y1);
ctx.lineTo(x2,y2);
ctx.closePath();
ctx.stroke();
}
canvas.addEventListener('click', (e) => {
canvas.width += 0;
const npc = drawRect('blue', 50, 50, 20, 20)
const house = drawRect('black', 150, 150, 50, 150)
drawRect('green', e.clientX, e.clientY, 20, 20)
const x1 = npc.x, y1 = npc.y, x2 = e.clientX, y2 = e.clientY;
const points = [];
for(let i = 0.0; i <= 1; i = i+0.01){
const gg = getPositionAlongTheLine(x1,y1,x2,y2, i);
drawRect('aqua' ,gg.x, gg.y, 2 , 2)
points.push({x: gg.x, y: gg.y, width: 10, height: 10})
}
for(let i = 0; i < points.length; i++){
if(collides({...points[i], width: 2, height: 2}, house)){
console.log('есть препятствие')
return;
}
}
drawLine(x1, y1, x2, y2)
})
// отдает координаты равные проценту расстояния: percentage максимум = 1
function getPositionAlongTheLine(x1, y1, x2, y2, percentage) {
return {x : x1 * (1.0 - percentage) + x2 * percentage, y : y1 * (1.0 - percentage) + y2 * percentage};
}
function collides(a,b){
return a.x < b.x + b.width &&
a.x + a.width > b.x &&
a.y < b.y + b.height &&
a.y + a.height > b.y;
}
<Select
isClearable
placeholder={props.placeholder}
classNamePrefix='custom-select'
components={{
ClearIndicator: () => <IoCloseOutline />,
IndicatorSeparator: () => null,
DropdownIndicator: () => <FaCaretDown />,
}}
styles={customSelectStyles}
options={props.options}
onChange={props.onChange}
/>
<div class="gg"></div>
<div class="tt"></div>
.gg{
z-index: 999;
width: 100px;
height: 100px;
background: red;
}
.tt{
z-index: 2;
width: 100px;
height: 100px;
background: blue;
margin-top: -50px;
}
gg
в данном случае это див с классом gg__children
<div class="gg">
<div class="gg__children"></div> // потомок
</div>
<div class="tt"></div>
.gg{
width: 100px;
height: 100px;
background: red;
z-index: 999;
}
.gg__children{
width: 50px;
height: 200px;
background: green;
z-index: 100;
}
.tt{
width: 100px;
height: 100px;
background: blue;
margin-top: -50px;
z-index: 2;
}