Skip to content

Instantly share code, notes, and snippets.

View aseredenko's full-sized avatar
💪

Alexander Seredenko aseredenko

💪
View GitHub Profile
@aseredenko
aseredenko / add-modal-open-class-bootstrap.js
Created June 27, 2016 12:26
Add "modal-open" class when hid one modal box and show another. Bootstrap
$(document).on('hidden.bs.modal', function (event) {
if ($('.modal:visible').length) {
$('body').addClass('modal-open');
}
});
@aseredenko
aseredenko / AutomaticMinDate
Created January 19, 2016 14:23
Add minimal date which calculated automaticly for input (in Example -75 years from current day)
// Add minimal value for date input
var date = new Date();
var currentYear = date.getFullYear();
var currentMonth = ('0' + (date.getMonth() + 1).toString()).slice(-2);
var currentDay = ('0' + (date.getDate()).toString()).slice(-2);
var minDate = currentYear-75 + "-" + currentMonth + "-" + currentDay;
@aseredenko
aseredenko / CheckInputSymbols.js
Created January 19, 2016 14:15
validateInputSymbolsByRegExp
function isRussian(input) {
var value = input.value;
var rep = /[\x00-\x7F]/;
if (rep.test(value)) {
value = value.split(rep).join("");
input.value = value;
}
}
$(document).click( function (event) {
if ($(event.target).closest(".page-navigation").length
|| $(event.target).closest(".nav-switcher").length) return;
// What to do on click
event.stopPropagation();
});
@aseredenko
aseredenko / skype.html
Last active November 29, 2015 18:49
Disable skype appearance links
<meta name="SKYPE_TOOLBAR" content="SKYPE_TOOLBAR_PARSER_COMPATIBLE" />
function getScrollTop(){
if(typeof pageYOffset!= 'undefined'){
//most browsers except IE before #9
return pageYOffset;
}
else{
var B= document.body; //IE 'quirks'
var D= document.documentElement; //IE with doctype
D= (D.clientHeight)? D: B;
return D.scrollTop;