const bb5 = document.querySelector("#bb5");
const bb6 = document.querySelector("#bb6");
const shoutboxForm = document.querySelector(".shoutbox-form");
const chxImageBbPrompt = document.querySelector(".chx-image-bb-prompt");
const chxLinkBbPrompt = document.querySelector(".chx-link-bb-prompt");
const chxColorBbPrompt = document.querySelector(".chx-color-bb-prompt");const heightFormBB = shoutboxForm.offsetHeight;
chxImageBbPrompt.style.height = heightFormBB - 3 + "px";
chxLinkBbPrompt.style.height = heightFormBB - 3 + "px";bb5.onclick = function() {
chxColorBbPrompt.style.display = "none";
chxLinkBbPrompt.style.display = "none";
chxImageBbPrompt.style.display = "block";
}bb6.onclick = function() {
chxImageBbPrompt.style.display = "none";
chxColorBbPrompt.style.display = "none";
chxLinkBbPrompt.style.display = "block";
}
Авиация
Сообщений 91 страница 100 из 134
Поделиться912023-02-02 02:09 am
Поделиться922023-02-02 04:34 am
function setRegForm() { if (r_e === 1) { if (document.querySelectorAll(".chx-signup-form-contents form").length === 0) { let form = document.createElement("form"); form.name = "chx-signup"; let input1 = document.createElement("input"); input1.type = "text"; input1.name = "reg_u"; input1.placeholder = ""; input1.required = true; let input2 = document.createElement("input"); input2.type = "password"; input2.name = "reg_p"; input2.placeholder = ""; input2.required = true; let input3 = document.createElement("input"); input3.type = "password"; input3.name = "c_reg_p"; input3.placeholder = ""; input3.required = true; let div = document.createElement("div"); div.className = "chx-login-button chxicon-login"; form.appendChild(input1); form.appendChild(input2); form.appendChild(input3); form.appendChild(div); document.querySelector('.chx-signup-form-contents').appendChild(form); } } else { let i = document.createElement("i"); i.className = "chxicon-lock chx-reg-disabled"; let p = document.createElement("p"); p.className = "chx-reg-disabled-caption"; document.querySelector('.chx-signup-form-contents').appendChild(i); document.querySelector('.chx-signup-form-contents').appendChild(p); } }
Поделиться932023-02-11 11:00 pm
const observer = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
if (mutation.type === "childList") {
const addedNodes = mutation.addedNodes;
for (let i = 0; i < addedNodes.length; i++) {
const node = addedNodes[i];
if (node.nodeName === "SCRIPT" && node.src === "https://dynamic_js.php") {
// run your function here
}
}
}
});
});observer.observe(document.body, {
childList: true,
subtree: true
});
Поделиться942023-02-11 11:12 pm
const observer = new MutationObserver(function(mutations) { mutations.forEach(function(mutation) { if (mutation.type === "childList") { const addedNodes = mutation.addedNodes; for (let i = 0; i < addedNodes.length; i++) { const node = addedNodes[i]; if (node.nodeName === "SCRIPT") { // run your function here } } } }); }); observer.observe(document.body, { childList: true, subtree: true });
Поделиться952023-02-12 12:03 am
function ajaxFormSubmitted() { setRegForm(); formButtonClick(); /*jQuery(".chx-login-form form").on("submit", function(e) {*/ const forms = document.querySelectorAll(".chx-login-form form"); forms.forEach(form => { form.onsubmit = function(e) { const xhr = new XMLHttpRequest(); xhr.open("POST", `${chatx_server}client/auth.php`, true); xhr.withCredentials = true; xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xhr.onload = function() { if (xhr.status === 200) { console.log("ss") removeOldDynamicJS(); getScript(chatx_server + "dynamic_js.php").then(() => { const data = JSON.parse(xhr.responseText); if (data.success) { document.querySelector(".chxicon-refresh").click(); } else { if (!document.querySelector(".chx-login-form chx_p")) { const p = document.createElement("chx_p"); p.textContent = data.message; document.querySelector(".chx-login-form").appendChild(p); } setTimeout(function() { document.querySelector(".chx-login-form chx_p").remove(); }, 2000); } }); } }; xhr.send(new URLSearchParams(new FormData(this)).toString()); e.preventDefault(); } });
Поделиться962023-02-12 01:12 am
function runFunctionOnce() {
let run = (function () {
let executed = false;
return function () {
if (!executed) {
executed = true;
console.log("Function is running for the first time");
} else {
console.log("Function has already run");
}
};
})();run();
}runFunctionOnce(); // "Function is running for the first time"
runFunctionOnce(); // "Function has already run"
Поделиться972023-02-12 06:00 am
function runOnce(func) {
return function wrapper() {
if (wrapper.hasRun) {
return;
}
wrapper.hasRun = true;
return func.apply(this, arguments);
};
}const myFunc = runOnce(function() {
console.log("This function will only run once.");
});myFunc(); // Output: "This function will only run once."
myFunc(); // Output: (nothing)
Поделиться982023-03-24 01:26 am
const loadNickname = () => !sessionName && (document.querySelector('#false_shoutbox_name').value = localStorage.nameElement);
Поделиться992023-03-24 01:32 am
const loadNickname = () => {
if (!sessionName) {
const nameElement = localStorage.nameElement;
document.querySelector('#false_shoutbox_name').value = nameElement || "";
}
};
Поделиться1002023-03-24 01:43 pm
declare(strict_types=1);
use Firebase\JWT\JWT;include_once 'settings.php';
include_once 'bbcode.php';try {
$token = JWT::decode($authHeader, $secretKey, ['HS512']);
if ($token->iss !== $serverName ||
$token->nbf > $now->getTimestamp() ||
$token->exp < $now->getTimestamp() ||
mb_strtolower($token->data->userName) === $b_u) {
exit;
}
} catch (Exception $e) {
$userIsGuest = true;
}
// Store the posted shout data to the data store
if(isset($_POST["name"]) && isset($_POST["comment"]) && mb_strlen($_POST['name'], 'utf-8') <= 25 && !empty($_POST['comment']) && mb_strlen($_POST['comment'], 'utf-8') <= $m_c) {
$name = htmlspecialchars($_POST["name"]);
$name = str_replace(array("\n", "\r"), '', $name);$comment = htmlspecialchars($_POST["comment"]);
$comment = str_replace(array("\n", "\r"), '', $comment);
if($userIsGuest && empty($comment)) {
die();
} else {
$comment = preg_replace('~https://i\.imgur\.com(*SKIP)(*FAIL)|https?://' . $_SERVER['SERVER_NAME'] . '(*SKIP)(*FAIL)|https?://~s', '', $comment);
}
$comment = showBBcodes($comment);if ($r_a === '1') {
if( $userIsGuest ) {
echo 'Access Denied';
die();
} else {
$shout = new \JamesMoss\Flywheel\Document(array(
'text' => $comment,
'name' => $token->data->userName,
'loggedIn' => 'true',
'createdAt' => time()
));
$repoShouts->store($shout);
}
} else {
if($userIsGuest) {
$shout = new \JamesMoss\Flywheel\Document(array(
'text' => $comment,
'name' => $name,
'createdAt' => time()
));
}
else {
$shout = new \JamesMoss\Flywheel\Document(array(
'text' => $comment,
'name' => $token->data->userName,
'loggedIn' => 'true',
'createdAt' => time()
));
}
$repoShouts->store($shout);
}
}
Быстрый ответ
Похожие темы
Космос | Обои для рабочего стола | 2025-01-03 |