var _____WB$wombat$assign$function_____ = function(name) {return (self._wb_wombat && self._wb_wombat.local_init && self._wb_wombat.local_init(name)) || self[name]; };
if (!self.__WB_pmw) { self.__WB_pmw = function(obj) { this.__WB_source = obj; return this; } }
{
  let window = _____WB$wombat$assign$function_____("window");
  let self = _____WB$wombat$assign$function_____("self");
  let document = _____WB$wombat$assign$function_____("document");
  let location = _____WB$wombat$assign$function_____("location");
  let top = _____WB$wombat$assign$function_____("top");
  let parent = _____WB$wombat$assign$function_____("parent");
  let frames = _____WB$wombat$assign$function_____("frames");
  let opener = _____WB$wombat$assign$function_____("opener");

/**
 * Функционал получения количества шарингов
 */
(function($) {

    var pluginName = 'aifShares';
    var apiUrl = 'https://webcf.waybackmachine.org/web/20201023190743/https://aif.ru/share_count.php';


    var aifShares = function (container, options)
    {
        this.container = $(container);
        this.options = $.extend({}, options);

        if (this.options['apiUrl'])
        {
            apiUrl = this.options['apiUrl'];
        }

        if (!this.options['title'])
        {
            this.options['title'] = $('meta[property="og:title"]').attr('content');
        }

        if (!this.options['description'])
        {
            this.options['description'] = $('meta[property="og:description"]').attr('content');
        }

        if (!this.options['image'])
        {
            this.options['image'] = $('meta[property="og:image"]').attr('content');
        }

        if (!this.options['url'])
        {
            this.options['url'] = $('meta[property="og:url"]').attr('content');
        }
        this.options['title'] = encodeURIComponent(this.options['title']);
        this.options['description'] = encodeURIComponent(this.options['description']);
        this.options['image'] = encodeURIComponent(this.options['image']);
        this.options['url'] = encodeURIComponent(this.options['url']);

        if (!this.options['providers']) // по умолчанию ['fb', 'vk', 'ok']
        {
            this.options['providers'] = new Array('fb', 'vk', 'ok');
        }
        this.init();
    };

    aifShares.prototype = {
        init: function ()
        {
            var self = this,
                c = this.container;

                //расставляем shares
            $.each( self.options['providers'],function(index,value) {
                self.getShares(value);
            });

            c.find('a').on('click', function (e)
            {
                e.preventDefault();
                var providerClass = $(this).attr('class');
                var site = providerClass.replace('aif_shares_', '').replace('_link_js', '');

                var links = {
                    'fb': 'https://webcf.waybackmachine.org/web/20201023190743/https://www.facebook.com/sharer.php?src=sp&u=' + self.options['url'] + '&utm_source=share2',
                    'vk': 'https://webcf.waybackmachine.org/web/20201023190743/https://vk.com/share.php?url=' + self.options['url'] + '&title=' + self.options['title'] + '&image=' + self.options['image'] + '&description=' + self.options['description'],
                    'ok': 'https://webcf.waybackmachine.org/web/20201023190743/https://connect.ok.ru/dk?st.cmd=WidgetSharePreview&st.shareUrl=' + self.options['url'],
                    'tw': 'https://webcf.waybackmachine.org/web/20201023190743/https://twitter.com/intent/tweet?text=' + self.options['title'] + '&url=' + self.options['url']
                };

                self.windowOpenString(links[site]);
            });

        },
        windowOpenString: function(url)
        {
            window.open( url, '_blank', 'scrollbars=0, resizable=1, menubar=0, left=100, top=100, width=550, height=440, toolbar=0, status=0');
        },
        getShares: function (provider)
        {
            var self = this;

            $.ajax({
                url: apiUrl + '?url=' + self.options['url'] + '&provider=' + provider,
                async: true,
                dataType: 'json',
                success: function (response)
                {
                    var shareContainer = self.container.find('.aif_shares_' + provider + '_share_count_js');
                    if (response && response.result == true)
                    {
                        if (response.data && response.data.count)
                        {
                            shareContainer.show();
                            shareContainer.text(response.data.count);
                        }
                        else
                        {
                            shareContainer.hide();
                        }
                    }
                    else
                    {
                        shareContainer.hide();
                        console.log(response.data || 'Ошибка загрузки данных');
                    }
                },
                error: function (response)
                {
                    shareContainer.hide();
                    console.log(response.data || 'Ошибка загрузки данных');
                }
            });
        }
    };


    $.fn.aifShares = function( method )
    {
        var data = this.data(pluginName);

        var obj = (!data) ? new aifShares(this, method) : data.obj;

        if(!data)
        {
            this.data(pluginName, {
                obj : obj
            });
        }

        // логика вызова метода
        if (typeof method !== 'object' && obj[method])
        {
            var args = Array.prototype.slice.call( arguments, 1 );
            return obj[ method ].apply(obj,args);
        }

        return this;
    }
})( jQuery );




}
/*
     FILE ARCHIVED ON 19:07:43 Oct 23, 2020 AND RETRIEVED FROM THE
     INTERNET ARCHIVE ON 21:32:17 Nov 16, 2024.
     JAVASCRIPT APPENDED BY WAYBACK MACHINE, COPYRIGHT INTERNET ARCHIVE.

     ALL OTHER CONTENT MAY ALSO BE PROTECTED BY COPYRIGHT (17 U.S.C.
     SECTION 108(a)(3)).
*/
/*
playback timings (ms):
  captures_list: 1.556
  exclusion.robots: 0.06
  exclusion.robots.policy: 0.036
  esindex: 0.024
  cdx.remote: 6.781
  LoadShardBlock: 223.83 (3)
  PetaboxLoader3.resolve: 342.012 (5)
  PetaboxLoader3.datanode: 104.455 (5)
  load_resource: 293.054 (2)
*/