const rand=(min, max)=>Math.floor(Math.random() * max) + min;
for (i=0; i<10;i++) console.log(rand(1,10))
9
4
2
8
7
9
4
6
4
3
var event = new Event('build');
// Listen for the event.
elem.addEventListener('build', function (e) { /* ... */ }, false);
// Dispatch the event.
elem.dispatchEvent(event);
$( document ).trigger( "myCustomEvent", [ "bim", "baz" ] );
var events=[];
this.on = function (event, callback) {
events.push({e: event, fn: callback});
}
this.activate = function (){
vars.active=true;
for(let e of events)
if (e.e==='active') e.fn.apply(this)
}
new Date("12.03.2019".replace(/(\d+)\.(\d+)\.(\d+)/, "$3-$2-$1"));
//Tue Mar 12 2019 03:00:00 GMT+0300 (Москва, стандартное время)
chrome.tabs.query({}, function(tabs){
for (const tab of tabs){
chrome.tabs.executeScript(tab.id, {
// указываете параметры скрипта
});
}
});
function Antist(){
var inptantsm = $('#antspm');
var AntiSpam = function(){
if(inptantsm){
if(isNaN(inptantsm.val()) == true){
inptantsm.val( 0 );
}else{
inptantsm.val( parseInt(inptantsm.val()) + 1 ); // Ошибка появляется тут!
}
}
}
setTimeout(AntiSpam, 1000);
console.log(inptantsm.val());
}
const feedbackSlider = () => {
let slideIndex = 1,
items = document.querySelectorAll(".feedback-slider-item"),
prev = document.querySelector(".main-prev-btn"),
next = document.querySelector(".main-next-btn");
const showSlides = (n) => {
if (n > items.length) {
slideIndex = 1;
}
if (n < 1) {
slideIndex = items.length;
}
items.forEach((item) => {
item.classList.add("animated");
item.style.display = "none";
});
items[slideIndex - 1].style.display = "block";
}
const plusSlides = (n, auto=false) => {
showSlides(slideIndex += n);
if (!auto) {
clearInterval(sliderInterval);
sliderInterval = timer();
}
items[slideIndex - 1].classList.remove(n>0?"slideInRight":"slideInLeft");
items[slideIndex - 1].classList.add(n>0?"slideInLeft":"slideInRight");
}
showSlides(slideIndex);
prev.addEventListener("click", () => { plusSlides(-1 ) });
next.addEventListener("click", () => { plusSlides( 1 ) });
const timer = () => setInterval(()=> { plusSlides(1,1) }, 5000);
let sliderInterval = timer();
}
var rc = setCookie == "Калининград" ? 4012 : ( setCookie == "Санкт-Петербург" ? 812 : 0),
rt = "8 (495) 777-77-77";
if (rc) $(`body *:contains('${rt}')`).each(function(i,el){
if (!$(el).find(`*:contains('${rt}')`).length)
$(el).html($(el).html().replace(rt, rt.replace("495", rc)))
});
greetings = Array ["Доброй ночи","Доброе утро","Добрый день","Добрый вечер"]
images = Array ["night","morning","afternoon","evening"]
offset = CurrentTime.Hours
if (offset > 23 || offset < 6) { offset = 0 }
else if (offset < 11) { offset = 1 }
else if (offset < 18) { offset = 2 }
else { offset = 3 }
std.io.write("<style>body: { background: url('images/"+images[offset]+".jpg')}</style>")
std.io.write(...)
....
std.io.write("<h2>"+greetings[offset]+"</h2>")