$('video').on('volumechange', function() {
console.log('volume has changed');
})
var $video = $('video'), $btn = $('.btn');
$btn.on('click', toggleMuteState);
$video.on('volumechange', toggleButtonClasses);
$video.prop('muted', false);
function toggleMuteState() {
$video.prop('muted', !$video.prop('muted'));
}
function toggleButtonClasses() {
$btn.toggleClass('mute unmute');
}
class Person {
constructor(name) {
this.name = name;
}
sayName() {
console.log('My name is ', this.name + '!');
}
sayHi() {
console.log('Hello everybody!');
}
}
class AngryPerson extends Person {
constructor(name, phrase) {
super(name);
this.phrase = phrase
}
sayHi() {
console.log('I just fucking hate you all');
}
saySomethingElse() {
console.log(this.phrase);
}
}
Jim = new Person('Jim');
// Object { name: "Jim" }
Jim.sayName();
// My name is Jim!
Jim.sayHi();
// Hello everybody!
Jim.saySomethingElse();
// TypeError: Jim.saySomethingElse is not a function
Bob = new AngryPerson('Bob', 'Please, leave me alone');
// Object { name: "Bob", phrase: "Please, leave me alone" }
Bob.sayName();
// My name is Bob!
Bob.sayHi();
// I just fucking hate you all
Bob.saySomethingElse();
// Please, leave me alone
<?php
/* attributes check */
if (!isset($_POST['some_attribute']) || empty($_POST['some_other_attribute'])) {
echo 'false';
exit();
}
/* attributes bindings */
$some_attribute = htmlspecialchars($_POST['some_attribute']);
$some_other_attribute = htmlspecialchars($_POST['some_other_attribute']);
/* quality attribute check */
if (strlen($some_attribute) > 10 || strlen($some_other_attribute) > 120) {
echo 'false';
exit();
}
$email = 'test@test.com'
$title = '=?utf8?b?' . base64_encode('some title') . '?=';
$ip = $_SERVER["REMOTE_ADDR"];
/* some hoster (and some php versions) may support date or current_time */
$date = date('d.m.Y H:i:s');
//$date = current_time('d.m.Y H:i:s', 0);
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
$headers .= 'From: from somewhere <'.$email.'>' . "\r\n";
$headers .= 'X-Mailer: PHP/' . phpversion();
$html = '<p>Hello! It is a sample email, enjoy!</p>';
if(mail($email, $title, $html, $headers)) {
echo 'true';
} else {
echo 'false';
}
$(body).on('click', '.name-class', (e) => {...});
if (document.getElementById("p2").style.display = "inline-block") {
document.getElementById("p2").style.display = "none";
}
jQuery.fn.extend({
equalHeights: function() {
var maxHeight = 0;
for (var i = 0; i < this.length; ++i) {
if (maxHeight < this.eq(i).height()) {
maxHeight = this.eq(i).height();
}
}
for (var i = 0; i < this.length; ++i) {
this.eq(i).height(maxHeight);
};
return this;
}
});