Skip to content

Instantly share code, notes, and snippets.

body.modal-open {
overflow: hidden;
}
$("#edit-followings").on("show", function () {
$("body").addClass("modal-open");
}).on("hidden", function () {
$("body").removeClass("modal-open")
});
document.getElementById('foo').onkeypress = function(e){
if (!e) e = window.event;
var keyCode = e.keyCode || e.which;
if (keyCode == '13'){
// Enter pressed
return false;
}
}
var jsonSearch = function(json_array,needle){
return json_array.map(function(d) { return d[Object.keys(needle)[0]]; }).indexOf(needle[Object.keys(needle)[0]])
};
a = [
{prop1:"abc",prop2:"qwe"},
{prop1:"bnmb",prop2:"yutu"},
{prop1:"zxvz",prop2:"qwrq"}];
index = a.findIndex(x => x.prop2 ==="yutu");
console.log(index);
@Fenil265
Fenil265 / REGEX FOR URLS
Created December 13, 2018 08:44
Reference for URL REGEX
https://mathiasbynens.be/demo/url-regex
$(selector).popover({ trigger: "manual" , html: false, animation:true})
.on("mouseenter", function () {
var _this = this;
$(this).popover("show");
$(".popover").on("mouseleave", function () {
$(_this).popover('hide');
});
}).on("mouseleave", function () {
var _this = this;
setTimeout(function () {
// Opera 8.0+
var isOpera = (!!window.opr && !!opr.addons) || !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0;
// Firefox 1.0+
var isFirefox = typeof InstallTrigger !== 'undefined';
// Safari 3.0+ "[object HTMLElementConstructor]"
var isSafari = /constructor/i.test(window.HTMLElement) || (function (p) { return p.toString() === "[object SafariRemoteNotification]"; })(!window['safari'] || (typeof safari !== 'undefined' && safari.pushNotification));
// Internet Explorer 6-11