This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return obj !== null && typeof obj === 'object' && !Array.isArray(obj); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isObject(obj) { | |
return obj?.constructor.name === 'Object'; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
shapes.point.x = shapes.point.x + shapes.point.velocity * Math.cos(angle / 180 * Math.PI); | |
shapes.point.y = shapes.point.y + shapes.point.velocity * Math.sin(angle / 180 * Math.PI); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var checkCollisions = function(rect1, rect2) { | |
var xOverlap = Math.abs(rect1.x - rect2.x) <= Math.max(rect1.width, rect2.width); | |
var yOverlap = Math.abs(rect1.y - rect2.y) <= Math.max(rect1.height, rect2.height); | |
return xOverlap && yOverlap; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
$(document).ready(function() { | |
$("#phone").mask("+7 (999) 99-99-999", {autoclear: false}); | |
$("#phone").click(function(){ | |
if($("#phone").val()=="+7 (___) __-__-___") { | |
$('#phone')[0].selectionStart = 4; | |
$('#phone')[0].selectionEnd = 4; | |
} | |
}) | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ua = navigator.userAgent.toLowerCase(); | |
var isOpera = (ua.indexOf('opera') > -1); | |
var isIE = (!isOpera && ua.indexOf('msie') > -1); | |
function getDocumentHeight() { | |
return Math.max(document.compatMode != 'CSS1Compat' ? document.body.scrollHeight : document.documentElement.scrollHeight, getViewportHeight()); | |
} | |
function getViewportHeight() { | |
return ((document.compatMode || isIE) && !isOpera) ? (document.compatMode == 'CSS1Compat') ? document.documentElement.clientHeight : document.body.clientHeight : (document.parentWindow || document.defaultView).innerHeight; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var setup = document.querySelector('.setup'); | |
var dialogHandler = setup.querySelector('.setup-user input'); | |
dialogHandler.addEventListener('mousedown', function(evt) { | |
evt.preventDefault(); | |
var startCoords = { | |
x: evt.clientX, | |
y: evt.clientY |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var ESC_KEYCODE = 27; | |
var ENTER_KEYCODE = 13; | |
// Нажатие на элемент .setup-open удаляет класс hidden | |
// у блока setup. Нажатие на элемент .setup-close, расположенный | |
// внутри блока setup возвращает ему класс hidden. | |
var setup = document.querySelector('.setup'); | |
var setupOpen = document.querySelector('.setup-open'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// get the container of the popup window | |
var wind = setup.querySelector('.popup-window'); | |
var closePopup = function() { | |
setup.classList.add('hidden'); | |
}; | |
document.body.addEventListener('click', function(evt) { | |
if (!wind.contains(evt.target)) { | |
closePopup(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('html').on('touchstart', function(e) { | |
$('.navbar-flyout').hide(); | |
}) | |
$(".navbar-flyout").on('touchstart',function(e) { | |
e.stopPropagation(); | |
}); | |
// http://qaru.site/questions/1412280/javascript-jquery-tap-outside-an-element-on-an-iphone |
NewerOlder