PageSourceSearch

https://www.badger.ru/bitrix/templates/aspro_max/js/observer.js

js badger.ru collected 2026-09-24 09:44:27 UTC 7,026 bytes, 208 lines download raw bytes

1if(
2	typeof AMutationObserver === 'undefined' &&
3	typeof MutationObserver === 'function'
4){
5	(function(w, d){
6		"use strict";
7
8		/* ES6 class definition */
9		/*
10		class AMutationObserver extends MutationObserver{
11			constructor(callback){
12				super(function(mutationsList, observer){
13					if(
14						AMutationObserver.ignore ||
15						observer.paused
16					){
17						// ignore mutations without disconnect()
18						//console.log('ignore observer callback', observer.id);
19					}
20					else{
21						callback(mutationsList, observer);
22					}
23				});
24
25				this.paused = true;
26				this.id = Math.floor(Math.random() * Math.floor(1000));
27
28				// define parent script
29				try{
30					eval('@');
31				}
32				catch(e){
33					// define parent script
34					if(typeof e.stack === 'string'){
35						this.stack = e.stack.match(/[^\s]*:[\d]+:[\d]+[^\s]/g);
36						this.stack.splice(0, 1);
37						var script = this.stack[0];
38
39						if(script.indexOf('yandex.ru/metrika') !== -1){
40							this.id = 'ym';
41						}
42						else{
43							script = script.replace(/^(.*[/])?(.*\.js)(.*)$/ig, '$2');
44							this.id = script.replace(/(\.min)?\.js$/i, '');
45						}
46					}
47				}
48				finally{
49					//console.log('new observer', this.id);
50				}
51			}
52
53			observe(target, options){
54				this.target = target;
55				this.options = options;
56				this.paused = false;
57				if(typeof AMutationObserver.observers[this.id] === 'undefined'){
58					AMutationObserver.observers[this.id] = this;
59				}
60				super.observe(target, options);
61			}
62
63			disconnect(){
64				this.paused = true;
65				super.disconnect();
66			}
67
68			takeRecords(){
69				if(
70					AMutationObserver.ignore ||
71					this.paused
72				){
73					// ignore mutations without disconnect()
74					//console.log('ignore observer takeRecords', this.id);
75					return [];
76				}
77				else{
78					return super.takeRecords();
79				}
80			}
81
82			pause(){
83				this.paused = true;
84			}
85
86			resume(){
87				if(typeof this.options !== 'false'){
88					this.paused = false;
89				}
90			}
91		}
92		*/
93
94		/* ES5 class definition */
95		var _AMutationObserver = /*#__PURE__*/function (_MutationObserver) {
96			"use strict";
97
98			_inheritsLoose(_AMutationObserver, _MutationObserver);
99
100			function _AMutationObserver(callback) {
101				var _this;
102
103				_this = _MutationObserver.call(this, function (mutationsList, observer) {
104					if (_AMutationObserver.ignore || observer.paused) {// ignore mutations without disconnect()
105						//console.log('ignore observer callback', observer.id);
106					}
107					else {
108						callback(mutationsList, observer);
109					}
110				}) || this;
111
112				_this.paused = true;
113				_this.id = Math.floor(Math.random() * Math.floor(1000));
114
115				try {
116					eval('@');
117				}
118				catch (e) {
119					// define parent script
120					if(typeof e.stack === 'string'){
121						_this.stack = e.stack.match(/[^\s]*:[\d]+:[\d]+[^\s]/g);
122						_this.stack.splice(0, 1);
123						var script = _this.stack[0];
124
125						if (script.indexOf('yandex.ru/metrika') !== -1) {
126							_this.id = 'ym';
127						}
128						else {
129							script = script.replace(/^(.*[/])?(.*\.js)(.*)$/ig, '$2');
130							_this.id = script.replace(/(\.min)?\.js$/i, '');
131						}
132					}
133				}
134				finally {
135					//console.log('new observer', _this.id);
136				}
137
138				return _this;
139			}
140
141			var _proto = _AMutationObserver.prototype;
142
143			_proto.observe = function observe(target, options) {
144				this.target = target;
145				this.options = options;
146				this.paused = false;
147
148				if (typeof _AMutationObserver.observers[this.id] === 'undefined') {
149					_AMutationObserver.observers[this.id] = this;
150				}
151
152				_MutationObserver.prototype.observe.call(this, target, options);
153			};
154
155			_proto.disconnect = function disconnect() {
156				this.paused = true;
157
158				_MutationObserver.prototype.disconnect.call(this);
159			};
160
161			_proto.takeRecords = function takeRecords() {
162				if (_AMutationObserver.ignore || this.paused) {
163					// ignore mutations without disconnect()
164					//console.log('ignore observer takeRecords', this.id);
165					return [];
166				}
167				else {
168					return _MutationObserver.prototype.takeRecords.call(this);
169				}
170			};
171
172			_proto.pause = function pause() {
173				this.paused = true;
174			};
175
176			_proto.resume = function resume() {
177				if (typeof this.options !== 'false') {
178					this.paused = false;
179				}
180			};
181
182			return _AMutationObserver;
183		}( /*#__PURE__*/_wrapNativeSuper(MutationObserver));
184
185		_AMutationObserver.ignore = false;
186		_AMutationObserver.observers = [];
187		_AMutationObserver.parent = MutationObserver;
188		_AMutationObserver.toString = function(){
189			return 'function MutationObserver() { [native code] }';
190		}
191		MutationObserver = _AMutationObserver;
192
193		/* ES2015 Babel functions (loose) */
194		function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
195
196		function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); }
vendor: 1,707 bytes, lines 196-208
196 if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
197
198		function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
199
200		function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
201
202		function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
203
204		function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
205
206		function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
207	})(window, document);
208}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.