let hash = function (str) {
var hash = 0;
if (typeof str == "object") {
var str = JSON.stringify(str);
if (str.length == 0) return hash;
for (i = 0; i < str.length; i++) {
char = str.charCodeAt(i);
hash = ((hash<<5)-hash)+char;
hash = hash & hash; // Convert to 32bit integer
}
} else {
var str = String(str);
if (str.length == 0) return hash;
for (i = 0; i < str.length; i++) {
char = str.charCodeAt(i);
hash = ((hash<<5)-hash)+char;
hash = hash & hash; // Convert to 32bit integer
}
}
return hash;
}
<input id="h"><br>
<div class="res">
<p>text 1</p>
<p>text 2</p>
<p>text 3</p>
</div>
.res {
height: 0px;
overflow: hidden;
width: fit-content;
}
.res.opened {
height: 100px;
overflow: scroll;
}
document.querySelector("#h").onfocus = () => {
document.querySelector(".res").classList.add("opened");
}
document.querySelector("#h").onblur = () => {
document.querySelector(".res").classList.remove("opened");
}
Замените это:
<img src="путь/к/картинке/картинка.png">
На это:
<img src-js="путь/к/картинке/картинка.png">
window.onload = () => {
let images = document.querySelectorAll("img");
for (let img of images) {
img.src = img.getAttribute("src-js");
img.removeAttribute("src-js");
}
}
img {
filter: grayscale(100%);
}
<div>kdjfkgjdg</div>
div {
position: relative;
margin: auto;
}
<div>kdjfkgjdg</div>
div {
position: relative;
left: 50%;
transform: translate(-50%, 0%);
}
<div>kdjfkgjdg</div>
div {
position: relative;
top: 50%;
transform: translate(0%, -50%);
}
<div>kdjfkgjdg</div>
div {
position: relative;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}
const nodemailer = require('nodemailer');
const directTransport = require('nodemailer-direct-transport');
const fromHost = `mysite.com`;
const from = 'site' + '@' + "gmail.com";
console.log('Email will be sent from:');
console.log(from, '\n');
// Ask for email address
const to = prompt('Enter your email address ').trim();
// Генерируем код
const trueVerificationCode = Math.round(Math.random() * (10e5 - 1)).toString();
const transport = nodemailer.createTransport(directTransport({
name: fromHost
}));
let y = trueVerificationCode;
// Отправляем письмо
transport.sendMail({
from, to,
subject: 'Verify your email address',
html: `
<div style="width:100%;display:flex;flex-direction:column;justify-content:center;
align-items:center;background:lightblue;padding:50px;box-sizing:border-box;">
<h1>Verify your email address</h1>
<p>Site has tried to verify your email address "${to}".
If this wasn't you, ignore and delete this email. Otherwise, the verification code is bellow:</p>
<div style="padding:50px;background:lightgray;border-radius:10px;font-size:30px;
font-family:monospace;">${trueVerificationCode}</div></div>
`
}, (err, data) => {
if (err) {
console.error('There was an error:', err);
} else {
console.log('\nVerification email sent, check your inbox\n');
const userVerificationCode = prompt('Enter your verification code ');
if (userVerificationCode == trueVerificationCode) {
console.log('Email address verified');
} else {
console.log('Code incorrect');
}
}
});
let y = window.open("", "test");
function reloadDOM(html) {
y.document.open();
y.document.write(html);
y.document.close();
}
reloadDOM(`<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>replit</title>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<!--CSS-->
</head>
<body>
<h1 class="comp">I'm a computer</h1>
<!--JS-->
<script src="h.js"></script>
<script>alert(2)</script>
</body>
</html>`);