const crypto = require("crypto");
const encryptedData =
"jPNGTNLtGIBc7Jv2UXj7a3FNQk13eUJ5T3VIUXlOS0ZVOEpnMUpPMnhvQXg5bE5kMGFHejVxaTFnYTA9";
const key = "qEExPE+jkJxQUt8fSO+XwzXgRGh6kLHy+lWEe6Z8T6s=";
const decodedKey = Buffer.from(key, "base64");
const decodedData = Buffer.from(encryptedData, "base64");
const ivLength = 16;
const iv = decodedData.slice(0, ivLength);
const encryptedText = decodedData.slice(ivLength);
const decipher = crypto.createDecipheriv("aes-256-cbc", decodedKey, iv);
try {
let decrypted = decipher.update(encryptedText, null, "utf8");
decrypted += decipher.final("utf8");
console.log("Расшифрованная строка:", decrypted);
} catch (error) {
console.error("Ошибка расшифровки:", error.message);
}
const commonOpt = {
key: 'val',
key1: 'val1'
}
const unitedOpt = {
...commonOpt,
key: 'lav'
}
const commonOpt = {
key: 'val',
key1: 'val1'
}
const unitedOpt = Object.assign(commonOpt, { key: 'lav' })
import requests
import time
import hashlib
import nacl.signing
import nacl.encoding
public_key = 'your_public_key_here'
secret_key = 'your_secret_key_here'
http_method = "POST"
route_path = "/get-item"
query_params = "Amount=%220.25%22&Limit=%22100%22&Offset=%22150%22&Order=%22desc%22"
body_string = ""
timestamp = str(int(time.time()))
non_signed_string = f"{http_method}{route_path}?{query_params}{body_string}{timestamp}"
signing_key = nacl.signing.SigningKey(secret_key, encoder=nacl.encoding.HexEncoder)
signed = signing_key.sign(non_signed_string.encode())
signature_hex = signed.signature.hex()
headers = {
'X-Api-Key': public_key,
'X-Sign-Date': timestamp,
'X-Request-Sign': signature_hex,
'Content-Type': 'application/json'
}
url = f"https://api.dmarket.com{route_path}?{query_params}"
response = requests.post(url, headers=headers, json={})
print(f"Status Code: {response.status_code}")
print(f"Response: {response.json()}")
.swiper-horizontal>.swiper-pagination-bullets.swiper-pagination-bullets-dynamic, .swiper-pagination-horizontal.swiper-pagination-bullets.swiper-pagination-bullets-dynamic {
left: 50%;
transform: translateX(-50%);
white-space: nowrap;
}
.swiper-pagination-bullets {
left: 0 !important;
transform: translateX(0) !important;
}
const childElement = document.getElementById('child'); // находим потомка
const parentElement = childElement.parentNode; // находим родителя
// Создаем новый элемент
const newElement = document.createElement('p');
newElement.textContent = 'Новый элемент';
// Заменяем старый элемент на новый
parentElement.replaceChild(newElement, childElement);
const oldElement = document.getElementById('old');
// Создаем новый элемент
const newElement = document.createElement('div');
newElement.textContent = 'Новый элемент';
// Заменяем старый элемент новым
oldElement.replaceWith(newElement);
const oldElement = document.getElementById('old');
oldElement.replaceWith(document.createRange().createContextualFragment(`
<div class="box box2">
<p1>hello world</p1>
</div>
`));
... {
opacity: 0;
scale: 0
}
const queryString =
"room_number[]=2&room_number[]=3&room_number[]=4&price_min=111&price_max=999&area[]=Ленинский район"
function convertQueryString(query) {
const result = []
const pairs = query.split("&")
pairs.forEach((pair) => {
const [name, value] = pair.split("=")
const cleanName = name.replace(/\[\]/g, "")
result.push({
name: cleanName,
value: decodeURIComponent(value),
})
})
return result
}
const output = convertQueryString(queryString)
console.log(output)
const queryString = "room_number[]=2&room_number[]=3&room_number[]=4&price_min=111&price_max=999&area[]=Ленинский район";
const output = queryString.split('&').map(pair => {
const [name, value] = pair.split('=')
return {
name: name.replace(/\[\]/g, ''),
value: decodeURIComponent(value),
}
})
console.log(output)
function scrollToElementWithOffset(element, offset = 0, behavior = 'smooth') {
const elementTopPosition = element.getBoundingClientRect().top
const offsetPosition = elementTopPosition + window.pageYOffset - offset
window.scrollTo({
top: offsetPosition,
behavior,
})
}
const targetElement = document.querySelector('#myElement');
scrollToElementWithOffset(targetElement, 100)
*:lang(en-US) {
outline: 2px solid deeppink;
}
*:lang(ru) {
color: red;
}