<?
class App{
protected static $_instance;
private function __construct(){
return new PDO('mysql:host=localhost;dbname=dbname','user','pass');
}
# Singlton methods
public static function getInstance()
{
self::$_instance = self::$_instance ?? new self;
return self::$_instance;
}
private function __clone() {}
private function __wakeup() {}
}
# Init
App::getInstance();
?>
$('.KEmoji_Input>div').on("input",function(){
alert(111);
});
$('.KEmoji_Input>div').on("DOMCharacterDataModified",function(){
alert(222);
});
function areArraysSame (argument1, argument2) {
if(argument1.length !== argument2.length) return false;
for (var i = 0; i < argument1.length; i++) {
if (argument1[i] === argument2[i]) {
continue;
} else {
return false;
}
}
return true;
};
// test
console.log(areArraysSame([1,2,3], [1,2,3]));
console.log(areArraysSame([1,2,3], [1,2,'3']));
console.log(areArraysSame([1,2,3], [1,2,3, 4]));
function imgResize(a) {
a.classList.toggle('imgresized');
}
var z = document.querySelectorAll('.imgresize-wrapper');
for(x = 0; x < z.length; x++) {
z[x].addEventListener('click', imgResize.bind(null, z[x])));
}
document.querySelector('.overallAmount').textContent = '100 000.00 руб.';
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
</body>
</html>
var o = {a:1, d:4, b:2, c:3};
Object.keys(o);
// Array(4) [ "a", "d", "b", "c" ]
var o = {a:1, d:4, b:2, c:3};
Object.keys(o).sort();
// Array(4) [ "a", "b", "c", "d" ]