PageSourceSearch

https://cdn.radiosputnik.ru/min/js/libs/banners/adfx.loader.bind.js?9f38418f8

js radiosputnik.ru collected 2026-09-24 17:09:46 UTC 7,346 bytes, 175 lines download raw bytes

1;"use strict";
2
3function replaceOriginalAdFoxMethods(){
4
5    if ( window.Ya && window.Ya.adfoxCode ){
6        window.Ya.adfoxCode._create = window.Ya.adfoxCode.create;
7        window.Ya.adfoxCode._createScroll = window.Ya.adfoxCode.createScroll;
8        window.Ya.adfoxCode._createAdaptive = window.Ya.adfoxCode.createAdaptive;
9    } else {
10        window.Ya = {
11            adfoxCode: {
12                _create : function(){},
13                _createScroll : function(){},
14                _createAdaptive : function(){}
15            }
16        }
17    }
18
19    window.Ya.adfoxCode.create = function( options ) {
20        options = AdFoxCallbackCheck( options );
21        window.Ya.adfoxCode._create( options );
22    };
23
24    window.Ya.adfoxCode.createScroll = function( options, states, a_options ) {
25        options = AdFoxCallbackCheck( options, states, a_options );
26        if ( states || a_options ){
27            window.Ya.adfoxCode._createScroll( options, states, a_options );
28        } else {
29            window.Ya.adfoxCode._createScroll( options );
30        }
31    };
32
33    window.Ya.adfoxCode.createAdaptive = function( options, states, a_options ) {
34        options = AdFoxCallbackCheck( options, states, a_options );
35        if ( a_options ){
36            window.Ya.adfoxCode._createAdaptive( options, states, a_options );
37        } else {
38            window.Ya.adfoxCode._createAdaptive( options, states );
39        }
40    };
41
42    /**
43     *  options = {
44     *      ownerId:        249922,
45     *      containerId:    'id тега куда выводить баннер',
46     *      params :        { объект параметров вызова баннера }
47     *
48     *  Во все колбэки передаваемые в options прокидывается объект options
49     *  его можно использовать для определния id блока и после замены его фукнциями в БС
50     *  или добавления параметров которые налдо читать в колбэках
51     *      onClose : function() {}
52     *      onError : function( error ) {}
53     *      onLoad : function( data ) {}
54     *      onRender : function() {}
55     *      onStub : function() {}
56     *
57     *  Добавить в опции баннера для отключения добавляемых колбэков
58     *      offAddOnClose : false;
59     *      offAddOnError : false;
60     *      offAddOnLoad : false;
61     *      offAddOnRender : false;
62     *      offAddOnStub : false;
63     *
64     *  }
65     *
66     * */
67
68    function AdFoxCallbackCheck( options, states, a_options ){
69        var onClose = typeof options.onClose === 'function' ? options.onClose : false;
70        var onLoad = typeof options.onLoad === 'function' ? options.onLoad : false;
71        var onRender = typeof options.onRender === 'function' ? options.onRender : false;
72        var onError = typeof options.onError === 'function' ? options.onError : AdFoxOnError;
73        var onStub = typeof options.onStub === 'function' ? options.onStub : false;
74        options.onClose = function(){
75            if ( onClose ) onClose( options );
76            if ( !options.offAddOnClose ) AdFoxOnClose( options );
77        };
78        options.onLoad = function( data ){
79            if ( onLoad ) onLoad( data, options );
80            if ( !options.offAddOnLoad ) AdFoxOnLoad( data, options );
81        };
82        options.onRender = function(){
83            if ( onRender ) onRender( options );
84            if ( !options.offAddOnRender ) AdFoxOnRender( options );
85        };
86        options.onError = function( error ){
87            if ( onError ) onError( error, options, states, a_options );
88            if ( !options.offAddOnError ) AdFoxOnError( error, options, states, a_options );
89        }
90        options.onStub = function(){
91            if ( onStub ) onStub( options );
92            if ( !options.offAddOnStub ) AdFoxOnStub( options );
93        };
94        return options;
95    }
96
97    function AdFoxOnClose( options ){
98        console.log( 'adfx onClose '  + options.containerId );
99    }
100
101    function AdFoxOnLoad( data, options ){
102        console.log( 'adfx onLoad '  + options.containerId + ' - ', data );
103    }
104
105    function AdFoxOnRender( options ){
106
107        console.log( 'adfx onRender ' + options.containerId + ' ACTIVE ADDED' );
108        $( '#' + options.containerId + '' ).parents( '.banner:first' ).addClass( 'm-active' );
109        $( window ).scroll().resize();
110
111    }
112
113    function AdFoxOnError( error, options, states, a_options ){
114        if ( states || a_options ){
115            console.log( 'adfx onError ' + options.containerId, error, options, states, a_options );
116        } else {
117            console.log( 'adfx onError ' + options.containerId, error, options );
118        }
119    }
120
121    function AdFoxOnStub( options ){
122        var $bBanners = $( '#' + options.containerId + '' ).parents( '.banner:first' );
123        if ( $bBanners.hasClass( 'm-not-stub' ) ){
124            console.log( 'adfx onStub ' + options.containerId );
125        } else {
126            $bBanners.removeClass( 'm-active' ).addClass( 'm-stub-removed' );
127            console.log( 'adfx onStub ' + options.containerId + ' ACTIVE REMOVED' );
128        }
129    }
130
131    function AdFoxCallbackCheck___Old( options, states, a_options ){
132        var onLoad = typeof options.onLoad === 'function' ? options.onLoad : AdFoxOnLoad;
133        var onRender = typeof options.onRender === 'function' ? options.onRender : AdFoxOnRender;
134        var onError = typeof options.onError === 'function' ? options.onError : AdFoxOnError;
135        var onStub = typeof options.onStub === 'function' ? options.onStub : AdFoxOnStub;
136        options.onLoad = function( data ){ onLoad( data, options ); };
137        options.onRender = function(){ onRender( options ); };
138        if ( states || a_options ){
139            options.onError = function( error ){ onError( error, options, states, a_options ); };
140        } else {
141            options.onError = function( error ){ onError( error, options ); };
142        }
143        options.onStub = function(){ onStub( options ); };
144        return options;
145    }
146    function AdFoxOnLoad___Old( data, options ){
147        console.log( 'adfx onLoad '  + options.containerId + ' - ' + data.bundleName );
148    }
149    function AdFoxOnRender___Old( options ){
150        console.log( 'adfx onRender ' + options.containerId + ' ACTIVE ADDED' );
151        $( '#' + options.containerId + '' ).parents( '.banner:first' ).addClass( 'm-active' );
152        $( window ).scroll().resize();
153    }
154    function AdFoxOnError___Old( error, options, states, a_options ){
155        if ( states || a_options ){
156            console.log( 'adfx onError ' + options.containerId, error, options, states, a_options );
157        } else {
158            console.log( 'adfx onError ' + options.containerId, error, options );
159        }
160    }
161    function AdFoxOnStub___Old( options ){
162        var $bBanners = $( '#' + options.containerId + '' ).parents( '.banner:first' );
163        if ( $bBanners.hasClass( 'm-not-stub' ) ){
164            console.log( 'adfx onStub ' + options.containerId );
165        } else {
166            $bBanners.removeClass( 'm-active' ).addClass( 'm-stub-removed' );
167            console.log( 'adfx onStub ' + options.containerId + ' ACTIVE REMOVED' );
168        }
169    }
170
171
172}
173
174
175

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.