Skip to content

Instantly share code, notes, and snippets.

window.someFunc = (function (func) {
return function () {
var out = func.apply(this, arguments);
// do something
return out;
};
})(window.someFunc);
@raindrop-ua
raindrop-ua / cookiescollector.js
Created February 10, 2016 12:48
Collect some IDs in cookies
if (!Array.prototype.indexOf) {
Array.prototype.indexOf = function(elt) {
var len = this.length >>> 0;
var from = Number(arguments[1]) || 0;
from = (from < 0) ? Math.ceil(from) : Math.floor(from);
if (from < 0) from += len;
for (; from < len; from++) {
if (from in this && this[from] === elt) return from;
}
return -1;
function addEvent(elem, event, fn) {
function listenHandler(e) {
var ret = fn.apply(this, arguments);
if (ret === false) {
e.stopPropagation();
e.preventDefault();
}
return(ret);
}
function attachHandler() {