This file contains 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 whenReady = function (name, context) { | |
context = context || window; | |
var def = Deferred(), _value; | |
Object.defineProperty(context, name, { | |
configurable: true, | |
get: function () { | |
return _value; | |
}, | |
set: function (value) { | |
_value = value; |
This file contains 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 frame = document.createElement('iframe'); | |
document.body.appendChild(frame); | |
for(var item in window) { | |
if(frame.contentWindow[item] === undefined){ | |
console.log(item, window[item]) | |
} | |
} |
This file contains 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 getTemplate = (function (html) { | |
var templates = {}; | |
//<([A-Z]\w+)[^>]*>([\s\S]*?)<\/([A-Z]\w+)[^>]*> | |
html.replace(/<template\s+data-template-name="(.+)"\s*>([\s\S]*?)<\/template>/g, function (str, name, value) { | |
templates[name] = value.replace(/([>{])\s+|\s+([<}])/g, '$1$2').replace(/\s+/g, ' '); | |
}); | |
return function (name, data) { | |
var template = templates[name]; | |
if (data) { | |
template = template.replace(/{{([^{}]+)}}/gm, function (match, p1) { |
This file contains 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 presetCss(){ | |
var preloadImages = function (context) { | |
var arrImg = context.match(/service.maxymiser.net\/cm\/images-[^\/]+([^)'"\\]+)/g) || []; | |
for (var i = 0; i < arrImg.length; i++) { | |
new Image().src = "//" + arrImg[i]; | |
} | |
}; | |
var campaignStyles = campaign.getStyles().join(' '); | |
if(campaignStyles) { |
This file contains 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 $ACTION = function (eventName) { | |
var SESSION_EVENT_NAME = 'MM_' + eventName; | |
var catchEvent = function (fn) { | |
var sessionEventValue = window.sessionStorage[SESSION_EVENT_NAME]; | |
if (typeof fn == 'function' && sessionEventValue) { | |
fn(sessionEventValue) | |
} | |
delete window.sessionStorage[SESSION_EVENT_NAME]; | |
}; |
This file contains 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
/* | |
The class Deferrer can register multiple callbacks into a callback queues, | |
invoke callback queues, and relay the success or failure state of any synchronous or asynchronous function. | |
*/ | |
function Deferred() { | |
var | |
eventManager = EventManager({once: true,memory: true}), | |
stateValue = 'pending'; | |
//Interface: presupposes that you can implement basic interface, and extended. | |
function Promise() { |
This file contains 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 mm = { | |
type:(function () { | |
var class2type = {}; | |
var arr = "Boolean Number String Function Array Date RegExp Object".split(" "); | |
for (var n = 0; n < arr.length; n++) { | |
class2type[ "[object " + arr[n] + "]" ] = arr[n].toLowerCase(); | |
} | |
return function (obj) { | |
return obj == null ? | |
String(obj) : |
This file contains 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
/** | |
* Possible options: | |
* | |
* once: will ensure the callback list can only be fired once in the triggered event. | |
* | |
* | |
* memory: will keep track of previous values and will call any callback functions added | |
* after the list has been fired right away with the latest 'memorized' values | |
* @param options {{once:boolean, memory: boolean}|undefined} | |
* @constructor |
This file contains 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
/** | |
* Класс для работы с приватными переменными | |
* @param data {Object|undefined} необязательный параметр | |
* @constructor | |
*/ | |
var PrivateValue = function (data) { | |
/** | |
* Установка переменных ключ значение или селектор значение | |
* @param name {String} | |
* @param val {*} |
This file contains 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
//Создание списка компаний с масивами максибоксов | |
mmcore.structGenInfo = {}; | |
mmcore._AddRenderer = decorate(mmcore._AddRenderer, function (mb, fn) { | |
var gi = mmcore.GenInfo, ngi = this.newGenInfo; | |
for (var com in gi) { | |
ngi[com] = ngi[com] || []; | |
if (gi[com][mb.toLowerCase()]) { | |
ngi[com].push(mb); | |
} | |
} |