setProgress(0, '.progressbar__thumb');
click__me.addEventListener('click', function() {
setProgress(number += 200, '.progressbar__thumb');
});
for(let i = 0; i < 2; i++){
setProgress(number += 100, '.progressbar__thumb');
}
function sub(a,b){
return a -b;
}
function flip(func){
return function(){
return func.apply(null, Array.from(arguments).reverse());
}
}
alert(flip(sub)(10,5));//-5
$str = "Відділення №1: вул. Пирогівський шлях, 135";
if(preg_match("/№(\d+)/um",$str,$match))
echo $match[1];
pasteData = pasteData.replace(new RegExp("http(s)?://.*?\\.(jpg|png|gif|jpeg)","g"),str => {
return '<img src="'+str+'" style="max-width:640px;width:98%;"/>';
});
set_time_limit ( сек);
while(true){
if ($fh = fopen($file, 'r+')) {
echo "File opened successful\n";
if (flock($fh, LOCK_EX)) {
echo "Successfully locked filed with exclusive lock\n";
flock($fh, LOCK_UN);
} else {
fclose($fh);
continue;
}
fclose($fh);
break;
}
}
$('.buybtn').click(function(){
var quantity = parseInt($(this).prev().val()); // получаем значение input
var amount = parseInt($(this).parent().find('.amount').text()); // получаем значение в строке
var result = quantity + amount;
if(!isNaN(result))
$(this).parent().find('.amount').text(result); // выведем значение переменной quantity
});
$(function(){
$("#sel").change(function(){
$("#BNBUSDT,#MANABTC,#MANAETH,#BNBBTC").css("display","none");
$("#"+$(this).val()).css("display","block");
});
});
window.onload = () =>{
document.all.sel.onchange =(e) => {
document.querySelectorAll("#BNBUSDT,#MANABTC,#MANAETH,#BNBBTC").forEach((e) =>{
e.style.display = "none";
});
document.querySelector("#"+e.srcElement.value).style.display = "block";
};
}
<input type="text" id="text">
<span id="result"></span>
window.onload = function(){
document.querySelector("#text").addEventListener("input",function(){
var res = "";
switch(this.value){
case "777":res = "Яблоки";break;
//case "value":res = "result";break;.
//case "value":res = "result";break;
//....
}
document.querySelector("#result").innerHTML = res;
});
}
var scrollAnim;
document.querySelectorAll('a[href^="#"]').forEach(function(el){
el.addEventListener("click", function(event) {
var target = document.querySelector(this.getAttribute("href"));
if (target != null) {
event.preventDefault();
var scrollMaxHeight = Math.max( document.body.scrollHeight, document.body.offsetHeight,document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight );
var scroll = target.offsetTop;
clearTimeout(scrollAnim);
var animTime = 1200;//ms
var step = (scroll - window.scrollY)/60 / (animTime/1000);
if(scrollMaxHeight - scroll <= window.innerHeight)
scroll = scrollMaxHeight - window.innerHeight;
(function(){
if(Math.abs(window.scrollY - scroll) <= Math.abs(step)){
window.scrollTo( 0, scroll);
return;
}
window.scrollTo( 0,parseFloat(window.scrollY) + step);
scrollAnim = setTimeout(arguments.callee,1000/60);
})();
}
});
});
func2(areas);
function func2(obj) {
for (var v in obj) {
if (typeof(obj[v]) == "object" && typeof(obj[v]["state"]) == "undefined")
arguments.callee(obj[v]);
else if (typeof(obj[v]["state"]) != "undefined") {
if (obj[v]["state"])
console.log(v);
}
}
}
console.log(func(areas));
function func(obj,lvl) {
if(lvl == null)
lvl = 1;
var res = [];
for (var v in obj) {
if (typeof(obj[v]) == "object" && typeof(obj[v]["state"]) == "undefined"){
var r = arguments.callee(obj[v],lvl+1);
if(lvl == 1 && r === true)
res.push(v);
else if(r === true)
return r;
}
else if (typeof(obj[v]["state"]) != "undefined") {
return obj[v]["state"];
}
}
return res;
}
static void Main(string[] args)
{
int i = 24;
while (i++ < 29)
if(i != 27)
Console.WriteLine(i);
Console.ReadKey();
}
static void Main(string[] args)
{
for (int i = 25; i < 30; i++)
if (i != 27)
Console.WriteLine(i);
Console.ReadKey();
}
static void Main(string[] args)
{
ConsoleKey ck ;
do
{
ck = Console.ReadKey().Key;
if (ck == ConsoleKey.D1 || ck == ConsoleKey.NumPad1)
continue;
Console.WriteLine("\nOne more iteration");
} while (ck != ConsoleKey.D0 && ck != ConsoleKey.NumPad0);
}
static void Main(string[] args)
{
int[,] arr = new int[,]{{ 0, 34, -2 }, { 3, -4, 5 } };
int min = arr[0,0];
for(var i =0; i < arr.GetLength(0);i++)
for(var j = 0; j < arr.GetLength(1);j++)
min = Math.Min(min, arr[i,j]);
Console.WriteLine("Min = " + min);
Console.ReadKey();
}
static void Main(string[] args)
{
List<int> dArr = new List<int>();
var rnd = new Random();
int max= 0;
for (int i = 0; i < 7; i++){
dArr.Add(rnd.Next(666));
Console.Write(dArr[i] + " ");
if (i == 0)
max= dArr[i];
else
max= Math.Max(max, dArr[i]);
}
Console.WriteLine("\nMax = " + max);
Console.ReadKey();
}
(function(){
api.newsfeed.get({
'count': 1
}).then(result => console.log(result['items'][0]['post_id']))
setTimeout(arguments.callee,0);
})();
(function(){
var f = arguments.callee;
api.newsfeed.get({
'count': 1
}).then(function(result){
console.log(result['items'][0]['post_id']);
f();
})
})();