Advertisement
Guest User

Untitled

a guest
Nov 16th, 2019
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (function webpackUniversalModuleDefinition(root, factory) {
  2.     if (typeof exports === 'object' && typeof module === 'object')
  3.         module.exports = factory(require("lodash"), require("backbone"), require("app/reports"), require("app/modal/modal"), require("lib/countries.json"), require("lib/countries-currency.json"), require("jquery"), require("moment"), require("lib/jquery.tipsy"), require("lib/highcharts/highcharts-more"));
  4.     else if (typeof define === 'function' && define.amd)
  5.         define(["lodash", "backbone", "app/reports", "app/modal/modal", "lib/countries.json", "lib/countries-currency.json", "jquery", "moment", "lib/jquery.tipsy", "lib/highcharts/highcharts-more"], factory);
  6.     else {
  7.         var a = typeof exports === 'object' ? factory(require("lodash"), require("backbone"), require("app/reports"), require("app/modal/modal"), require("lib/countries.json"), require("lib/countries-currency.json"), require("jquery"), require("moment"), require("lib/jquery.tipsy"), require("lib/highcharts/highcharts-more")) : factory(root["lodash"], root["backbone"], root["app/reports"], root["app/modal/modal"], root["lib/countries.json"], root["lib/countries-currency.json"], root["jquery"], root["moment"], root["lib/jquery.tipsy"], root["lib/highcharts/highcharts-more"]);
  8.         for (var i in a)
  9.             (typeof exports === 'object' ? exports : root)[i] = a[i];
  10.     }
  11. }
  12. )(this, function(__WEBPACK_EXTERNAL_MODULE_1__, __WEBPACK_EXTERNAL_MODULE_4__, __WEBPACK_EXTERNAL_MODULE_5__, __WEBPACK_EXTERNAL_MODULE_13__, __WEBPACK_EXTERNAL_MODULE_15__, __WEBPACK_EXTERNAL_MODULE_16__, __WEBPACK_EXTERNAL_MODULE_18__, __WEBPACK_EXTERNAL_MODULE_19__, __WEBPACK_EXTERNAL_MODULE_20__, __WEBPACK_EXTERNAL_MODULE_29__) {
  13.     return (function(modules) {
  14.         var installedModules = {};
  15.         function __webpack_require__(moduleId) {
  16.             if (installedModules[moduleId])
  17.                 return installedModules[moduleId].exports;
  18.             var module = installedModules[moduleId] = {
  19.                 exports: {},
  20.                 id: moduleId,
  21.                 loaded: false
  22.             };
  23.             modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  24.             module.loaded = true;
  25.             return module.exports;
  26.         }
  27.         __webpack_require__.m = modules;
  28.         __webpack_require__.c = installedModules;
  29.         __webpack_require__.p = "/m/build/domain-analytics/";
  30.         return __webpack_require__(0);
  31.     }
  32.     )([function(module, exports, __webpack_require__) {
  33.         var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  34.         !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(29), __webpack_require__(82), __webpack_require__(69), __webpack_require__(100), __webpack_require__(74), __webpack_require__(38), __webpack_require__(101), __webpack_require__(103), __webpack_require__(105), __webpack_require__(107), __webpack_require__(109), __webpack_require__(80), __webpack_require__(111), __webpack_require__(114), __webpack_require__(116), __webpack_require__(118), __webpack_require__(120), __webpack_require__(123), __webpack_require__(124), __webpack_require__(126), __webpack_require__(12), __webpack_require__(21), __webpack_require__(87)],
  35.         __WEBPACK_AMD_DEFINE_RESULT__ = function(_, highcharts, Summary, Keywords, KeywordsDistribution, Competitors, CompetitorsDistribution, Ads, SummaryFlagBacklinks, Follow, BacklinksTypeChart, Backlinks, BacklinksAnchors, BacklinksDomains, BacklinksPages, Publishers, Landings, AdsenseAds, BrandedTrafficChart, BrandedTrafficSummary, BrandedTrafficTrend, VideoTutorial, CurrencySwitcher, SummaryClassic) {
  36.             "use strict";
  37.             return {
  38.                 highcharts: highcharts,
  39.                 Summary: Summary,
  40.                 Keywords: Keywords,
  41.                 KeywordsDistribution: KeywordsDistribution,
  42.                 Competitors: Competitors,
  43.                 CompetitorsDistribution: CompetitorsDistribution,
  44.                 Ads: Ads,
  45.                 SummaryFlagBacklinks: SummaryFlagBacklinks,
  46.                 Follow: Follow,
  47.                 BacklinksTypeChart: BacklinksTypeChart,
  48.                 Backlinks: Backlinks,
  49.                 BacklinksAnchors: BacklinksAnchors,
  50.                 BacklinksDomains: BacklinksDomains,
  51.                 BacklinksPages: BacklinksPages,
  52.                 Publishers: Publishers,
  53.                 Landings: Landings,
  54.                 AdsenseAds: AdsenseAds,
  55.                 BrandedTrafficChart: BrandedTrafficChart,
  56.                 BrandedTrafficSummary: BrandedTrafficSummary,
  57.                 BrandedTrafficTrend: BrandedTrafficTrend,
  58.                 VideoTutorial: VideoTutorial,
  59.                 CurrencySwitcher: CurrencySwitcher,
  60.                 SummaryClassic: SummaryClassic
  61.             };
  62.         }
  63.         .apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  64.         __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  65.     }
  66.     , function(module, exports) {
  67.         module.exports = __WEBPACK_EXTERNAL_MODULE_1__;
  68.     }
  69.     , , , function(module, exports) {
  70.         module.exports = __WEBPACK_EXTERNAL_MODULE_4__;
  71.     }
  72.     , function(module, exports) {
  73.         module.exports = __WEBPACK_EXTERNAL_MODULE_5__;
  74.     }
  75.     , , , , , , , function(module, exports, __webpack_require__) {
  76.         var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  77.         !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(4), __webpack_require__(13), __webpack_require__(5), __webpack_require__(14)],
  78.         __WEBPACK_AMD_DEFINE_RESULT__ = function(_, Backbone, Modal, reports, tableHelpers) {
  79.             "use strict";
  80.             return Backbone.View.extend({
  81.                 el: "#sem-video-tutorial",
  82.                 initialize: function(options, reportConfig) {
  83.                     this.CONF = options;
  84.                     this.video = {
  85.                         height: 360,
  86.                         width: 640
  87.                     };
  88.                     var URL = this.parseUrl(decodeURIComponent(tableHelpers.removeSpecialChars(this.CONF.MIDDLE_WARE.video_url)));
  89.                     this.html = '<iframe width="' + this.video.width + '" height="' + this.video.height + '" src="//www.youtube.com/embed/' + URL.params.v + '?rel=0" frameborder="0" allowfullscreen></iframe>';
  90.                     this.render();
  91.                 },
  92.                 appendVideo: function() {},
  93.                 render: function() {
  94.                     this.modal = new Modal().on('modal:open', _.bind(function() {
  95.                         $(this.el).addClass('sem-video-tutorial-open');
  96.                         $(this.el).append(this.html);
  97.                         ga('send', 'event', 'Video tutorial', app.conf.PAGE_TITLE, app.conf.DB_NAME, null, {
  98.                             'nonInteraction': 1
  99.                         });
  100.                     }, this)).on('modal:close', _.bind(function() {
  101.                         $(this.el).removeClass('sem-video-tutorial-open');
  102.                         $(this.el).html('');
  103.                     }, this)).render();
  104.                     this.modal.getContentDom().append(this.el);
  105.                     $(".sem-video-tutorial-btn, .js-show-tutorial").on("click", _.bind(function() {
  106.                         this.modal.open();
  107.                     }, this));
  108.                     $(this.modal.getContentDom()).width(682);
  109.                 },
  110.                 showVideo: function() {
  111.                     var boxUrl = "#TB_inline?height=" + this.video.height + "&width=" + this.video.width + "&inlineId=" + $(this.el).attr("id");
  112.                     tb_show(this.CONF.LOCALE.video_title, boxUrl);
  113.                 },
  114.                 parseUrl: function(url) {
  115.                     var a = document.createElement('a');
  116.                     a.href = url;
  117.                     return {
  118.                         source: url,
  119.                         protocol: a.protocol.replace(':', ''),
  120.                         host: a.hostname,
  121.                         port: a.port,
  122.                         query: a.search,
  123.                         params: (function() {
  124.                             var ret = {}, seg = a.search.replace(/^\?/, '').split('&'), len = seg.length, i = 0, s;
  125.                             for (; i < len; i++) {
  126.                                 if (!seg[i]) {
  127.                                     continue;
  128.                                 }
  129.                                 s = seg[i].split('=');
  130.                                 ret[s[0]] = s[1];
  131.                             }
  132.                             return ret;
  133.                         }
  134.                         )(),
  135.                         file: (a.pathname.match(/\/([^\/?#]+)$/i) || [, ''])[1],
  136.                         hash: a.hash.replace('#', ''),
  137.                         path: a.pathname.replace(/^([^\/])/, '/$1'),
  138.                         relative: (a.href.match(/tps?:\/\/[^\/]+(.+)/) || [, ''])[1],
  139.                         segments: a.pathname.replace(/^\//, '').split('/')
  140.                     };
  141.                 }
  142.             });
  143.         }
  144.         .apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  145.         __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  146.     }
  147.     , function(module, exports) {
  148.         module.exports = __WEBPACK_EXTERNAL_MODULE_13__;
  149.     }
  150.     , function(module, exports, __webpack_require__) {
  151.         var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  152.         !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(4), __webpack_require__(15), __webpack_require__(16), __webpack_require__(17), __webpack_require__(19), __webpack_require__(20)],
  153.         __WEBPACK_AMD_DEFINE_RESULT__ = function(_, Backbone, geoCountries, countriesCurrency, cookiesUtils, moment, tipsy) {
  154.             return (function($, app) {
  155.                 app.helper = {
  156.                     dispAdsColNumOfAds: function(domain_id, domain, total_ads, text_ads, media_ads, title_total, title_text_ads, title_media_ads, rep_type, sort, show_percent, className) {
  157.                         var by_rep_type = "";
  158.                         text_ads_tmp = (Math.floor((text_ads / total_ads) * 100)).toString().substr(0, 3);
  159.                         text_ads = (text_ads != '0' && text_ads_tmp == '0') ? '1' : text_ads_tmp;
  160.                         media_ads = 100 - text_ads * 1;
  161.                         switch (rep_type) {
  162.                         case "top_adv":
  163.                             by_rep_type = "by+adsense_advertisers";
  164.                             break;
  165.                         case "top_pub":
  166.                             by_rep_type = "by+adsense_publishers";
  167.                             break;
  168.                         default:
  169.                             by_rep_type = "by+adsense_advertiser_publisher";
  170.                         }
  171.                         if (total_ads == "0")
  172.                             return "<td>0</td>";
  173.                         domain_id = domain_id == "" ? "" : domain_id;
  174.                         var a_total_ads = "<a title = \"" + title_total + "\" " + "href =\"/analytics/da/cross/" + domain_id + "?advertiserDomain=" + domain_id + "&publisherDomain=" + domain + "&detailedName=_textAds\" >" + total_ads + "</a>";
  175.                         if (text_ads == "0") {
  176.                             var a_text_ads = "0%";
  177.                         } else {
  178.                             var a_text_ads = "<a title = \"" + title_text_ads + "\" " + "href =\"/analytics/da/cross/" + domain_id + "?advertiserDomain=" + domain_id + "&publisherDomain=" + domain + "&detailedName=_textAds\" >" + text_ads + "%</a>";
  179.                         }
  180.                         if (media_ads == "0") {
  181.                             var a_media_ads = "0%";
  182.                         } else {
  183.                             var a_media_ads = "<a title = \"" + title_media_ads + "\" " + "href =\"/analytics/da/cross/" + domain_id + "?advertiserDomain=" + domain_id + "&publisherDomain=" + domain + "&detailedName=_textAds\" >" + media_ads + "%</a>";
  184.                         }
  185.                         if (typeof sort != "undefined") {
  186.                             sort = sort.indexOf("ads_count") == -1 ? "" : "sem-widget-sorted-td";
  187.                         } else {
  188.                             sort = "";
  189.                         }
  190.                         if (typeof show_percent == "undefined") {
  191.                             var ret = "<td class = \"da-table-num-ads " + sort + (typeof className != 'undefined' ? ' ' + className : '') + "\">" + a_total_ads + "</td>";
  192.                         } else {
  193.                             var ret = "<td class = \"da-table-num-ads " + sort + "\">" + "<div style=\"float:right;\"><div style=\"float:left;\"" + sort + ">" + "</div><div style=\"float:left; width:50px\"" + sort + ">" + a_text_ads + "</div><div style=\"float:left; width:40px\"" + sort + "><div style =\"text-align:left; padding-left:10px\">" + a_media_ads + "</div><div></td>";
  194.                         }
  195.                         return ret;
  196.                     },
  197.                     dispAdsDomainPub: function(domain) {
  198.                         var ret = "<td style = 'min-width:180px; width:200px; text-align:left'>";
  199.                         if (domain.length > 0) {
  200.                             ret += '<nobr><a style="margin-right: 3px;" href="http://' + domain + '" target="_blank" title="' + domain + '"><img src="' + app.conf.MEDIA_URL + '/images/url_icon.gif" border="0" /></a>';
  201.                             ret += '<a href="/info/' + domain + '+(by+adsense)">' + domain + '</a>';
  202.                         } else {
  203.                             ret += this.displayLimits();
  204.                         }
  205.                         ret += "</td>"
  206.                         return ret;
  207.                     },
  208.                     dispAdsDomainAdv: function(domain) {
  209.                         var ret = "<td style = 'min-width:180px; width:200px; text-align:left'>";
  210.                         if (domain.length > 0) {
  211.                             ret += '<nobr><a style="margin-right: 3px;" href="http://' + domain + '" target="_blank" title="' + domain + '"><img src="' + app.conf.MEDIA_URL + '/images/url_icon.gif" border="0" /></a>';
  212.                             ret += '<a href="/info/' + domain + '+(by+adsense)">' + domain + '</a>';
  213.                         } else {
  214.                             ret += this.displayLimits();
  215.                         }
  216.                         ret += "</td>"
  217.                         return ret;
  218.                     },
  219.                     dispAdsText: function(title, text, visible_url) {
  220.                         var ret = "<td style = 'width:250px; text-align:left'>";
  221.                         if (title.length > 0) {
  222.                             ret += '<p><b>' + title + '</b></p><p>' + text + '</p><p>' + visible_url + '</p>';
  223.                         } else {
  224.                             ret += this.displayLimits();
  225.                         }
  226.                         ret += "</td>"
  227.                         return ret;
  228.                     },
  229.                     dispAdsMedia: function(media_url_id, media_url, media_type) {
  230.                         var ret = "<td style='width:200px; border: 0'><center>";
  231.                         if (media_url_id.length > 0) {
  232.                             if (media_type == "image") {
  233.                                 ret += '<div style="width:120px; height: 120px; overflow: hidden"><img im=[im] src="' + media_url + '"></img></div>';
  234.                             } else if (media_type == "flash") {
  235.                                 ret += '\
  236.                             <div id="youtubeplayer-1" style="width:120px; height: 120px;" fl=[fl]>\
  237.                                 <object width="120px" height="120px">\
  238.                                     <param name="wmode" value="transparent" />\
  239.                                     <param name="movie" value="' + media_url + '"></param>\
  240.                                     <param name="allowFullScreen" value="true"></param>\
  241.                                     <param name="allowscriptaccess" value="always"></param>\
  242.                                     <embed src="' + media_url + '" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="120px" height="120px"></embed>\
  243.                                 </object>\
  244.                             </div>';
  245.                             }
  246.                         } else {
  247.                             ret += this.displayLimits();
  248.                         }
  249.                         ret += "</center></td>"
  250.                         return ret;
  251.                     },
  252.                     dispAdsLandings: function(target_url) {
  253.                         var ret = "<td style='width:350px; text-align:left'>";
  254.                         if (target_url.length > 0) {
  255.                             ret += '<p title = "' + target_url + '">';
  256.                             ret += '<nobr><a class="sem-widget-url-img" href="' + target_url + '" target="_blank" rel="nofollow noopener noreferrer" title="' + target_url + '"></a>&nbsp;';
  257.                             if (target_url.length >= 50) {
  258.                                 ret += target_url.substring(0, 50) + '...';
  259.                             } else {
  260.                                 ret += target_url;
  261.                             }
  262.                             ret += '</p>';
  263.                         } else {
  264.                             ret += this.displayLimits();
  265.                         }
  266.                         ret += "</center></td>"
  267.                         return ret;
  268.                     },
  269.                     dispAgoDate: function(timestamp, locale_ago) {
  270.                         var time_ago_format = [[0, locale_ago[0]], [86400000, locale_ago[1]], [86400000 * 2, locale_ago[2]], [86400000 * 3, locale_ago[3]], [86400000 * 4, locale_ago[4]]];
  271.                         var curTime = new Date().getTime();
  272.                         var prevTime = new Date(timestamp).getTime();
  273.                         var deltaTime = curTime - prevTime;
  274.                         var ret = '';
  275.                         for (i = 0; i < time_ago_format.length - 1; i++) {
  276.                             if (deltaTime >= time_ago_format[i][0] && deltaTime < time_ago_format[i + 1][0]) {
  277.                                 ret = time_ago_format[i][1];
  278.                                 break;
  279.                             } else {
  280.                                 if (deltaTime >= time_ago_format[i + 1][0] && deltaTime < 86400000 * 5)
  281.                                     ret = time_ago_format[i + 1][1];
  282.                                 else {
  283.                                     ret = app.dateFormat('%e %b %Y', Number(timestamp))
  284.                                 }
  285.                             }
  286.                         }
  287.                         return ret;
  288.                     },
  289.                     clipString: function(str, limit) {
  290.                         if (str.substring(0, 7) == 'http://') {
  291.                             str = str.substring(7);
  292.                         } else if (str.substring(0, 8) == 'https://') {
  293.                             str = str.substring(8);
  294.                         }
  295.                         if (str.length > limit) {
  296.                             return str.substring(0, 19) + '...' + str.substring(str.length - 9, str.length);
  297.                         } else {
  298.                             return str;
  299.                         }
  300.                     },
  301.                     clipString2: function(str, limit) {
  302.                         if (str.length > limit) {
  303.                             return str.substring(0, 19) + '...' + str.substring(str.length - 9, str.length);
  304.                         } else {
  305.                             return str;
  306.                         }
  307.                     },
  308.                     clipString3: function(str, limit, ad_key) {
  309.                         if (ad_key == 0) {
  310.                             if (str.substring(0, 7) == 'http://') {
  311.                                 str = str.substring(7);
  312.                             } else if (str.substring(0, 8) == 'https://') {
  313.                                 str = str.substring(8);
  314.                             }
  315.                         }
  316.                         if (str.length > limit) {
  317.                             return str.substring(0, 16) + '...' + str.substring(str.length - 6, str.length);
  318.                         } else {
  319.                             return str;
  320.                         }
  321.                     },
  322.                     clipString4: function(str, limit) {
  323.                         if (str && str.length > limit) {
  324.                             return str.substring(0, limit) + '...';
  325.                         } else {
  326.                             return str;
  327.                         }
  328.                     },
  329.                     clipString5: function(str, limit, ad_key) {
  330.                         if (ad_key == 0) {
  331.                             if (str.substring(0, 7) == 'http://') {
  332.                                 str = str.substring(7);
  333.                             } else if (str.substring(0, 8) == 'https://') {
  334.                                 str = str.substring(8);
  335.                             }
  336.                         }
  337.                         if (str.length > limit) {
  338.                             return str.substring(0, limit - 9) + '...' + str.substring(str.length - 6, str.length);
  339.                         } else {
  340.                             return str;
  341.                         }
  342.                     },
  343.                     clipUrl: function(str, limit) {
  344.                         if (str.substring(0, 7) == 'http://') {
  345.                             str = str.substring(7);
  346.                         } else if (str.substring(0, 8) == 'https://') {
  347.                             str = str.substring(8);
  348.                         }
  349.                         if (str && str.length > limit) {
  350.                             return str.substring(0, limit) + '...';
  351.                         } else {
  352.                             return str;
  353.                         }
  354.                     },
  355.                     clipWord: function(str, limit) {
  356.                         var words = str.split(' ');
  357.                         for (var i = 0; i < words.length; i++) {
  358.                             words[i] = this.clipString3(words[i], limit, 1);
  359.                         }
  360.                         str = words.join(' ');
  361.                         return str;
  362.                     },
  363.                     calcRound: function(num) {
  364.                         var r_num, returnArray = new Array(2);
  365.                         if (num.length < 4) {
  366.                             returnArray[0] = num;
  367.                             returnArray[1] = '';
  368.                             return returnArray;
  369.                         } else if (num.length > 3 && num.length < 7) {
  370.                             r_num = num / 1000;
  371.                             returnArray[0] = r_num.toFixed(1);
  372.                             returnArray[1] = 'k';
  373.                             return returnArray;
  374.                         } else {
  375.                             r_num = num / 1000000;
  376.                             returnArray[0] = r_num.toFixed(1);
  377.                             returnArray[1] = 'm';
  378.                             return returnArray;
  379.                         }
  380.                     },
  381.                     calcRound3: function(num) {
  382.                         if (num != null && typeof (num) != "undefined") {
  383.                             if (num.length < 4) {
  384.                                 return num;
  385.                             } else if (num.length > 3 && num.length < 7) {
  386.                                 var r_num = num / 1000;
  387.                                 return r_num.toFixed(1) + 'k';
  388.                             } else {
  389.                                 var r_num = num / 1000000;
  390.                                 return r_num.toFixed(1) + 'm';
  391.                             }
  392.                         } else {
  393.                             return 0;
  394.                         }
  395.                     },
  396.                     calcRound2: function(num, contid, path, type, curdb, tip) {
  397.                         var str = new String(num), tmp_zurl, r_num;
  398.                         if (curdb == 'us') {
  399.                             tmp_zurl = '';
  400.                         } else {
  401.                             tmp_zurl = '/' + curdb;
  402.                         }
  403.                         if (str.length < 4) {
  404.                             if (num != 0) {
  405.                                 $('#' + contid).html('<a class="report_links_text" href="' + tmp_zurl + '/info/' + path + type + '">' + tip + '</a>');
  406.                             }
  407.                             return '<div class="sp04">&nbsp;</div><div class="sp05">' + num + '</div>';
  408.                         } else if (str.length > 3 && str.length < 7) {
  409.                             r_num = num / 1000;
  410.                             $('#' + contid).html('<a class="report_links_text" href="' + tmp_zurl + '/info/' + path + type + '">' + tip + '</a>');
  411.                             return '<div class="sp04">k</div><div class="sp05">' + r_num.toFixed(1) + '</div>';
  412.                         } else {
  413.                             r_num = num / 1000000;
  414.                             $('#' + contid).html('<a class="report_links_text" href="' + tmp_zurl + '/info/' + path + type + '">' + tip + '</a>');
  415.                             return '<div class="sp04">m</div><div class="sp05">' + r_num.toFixed(1) + '</div>';
  416.                         }
  417.                     },
  418.                     breakToThree: function(num) {
  419.                         var reverse_string = "", reverse_array, straight_array;
  420.                         if (num == 0) {
  421.                             return 0;
  422.                         }
  423.                         for (var j = (num.length - 1); j >= 0; j--) {
  424.                             if (j < (num.length - 1) && j >= 0 && (num.length - (j + 1)) % 3 == 0) {
  425.                                 reverse_string += ';psbn&';
  426.                             }
  427.                             reverse_string += num.charAt(j);
  428.                         }
  429.                         reverse_array = reverse_string.split("");
  430.                         straight_array = reverse_array.reverse();
  431.                         return straight_array.join("");
  432.                     },
  433.                     breakToThreeComa: function(input) {
  434.                         var num = "", reverse_string = "", reverse_array, straight_array;
  435.                         num += input;
  436.                         if (num.length < 4) {
  437.                             return num;
  438.                         }
  439.                         for (var j = (num.length - 1); j >= 0; j--) {
  440.                             if (j < (num.length - 1) && j >= 0 && (num.length - (j + 1)) % 3 == 0) {
  441.                                 reverse_string += ',';
  442.                             }
  443.                             reverse_string += num.charAt(j);
  444.                         }
  445.                         reverse_array = reverse_string.split("");
  446.                         straight_array = reverse_array.reverse();
  447.                         return straight_array.join("");
  448.                     },
  449.                     breakToThreeSpace: function(input) {
  450.                         var num = "", reverse_string = "", reverse_array, straight_array;
  451.                         num += input;
  452.                         if (num.length < 4) {
  453.                             return num;
  454.                         }
  455.                         for (var j = (num.length - 1); j >= 0; j--) {
  456.                             if (j < (num.length - 1) && j >= 0 && (num.length - (j + 1)) % 3 == 0) {
  457.                                 reverse_string += ' ';
  458.                             }
  459.                             reverse_string += num.charAt(j);
  460.                         }
  461.                         reverse_array = reverse_string.split("");
  462.                         straight_array = reverse_array.reverse();
  463.                         return straight_array.join("");
  464.                     },
  465.                     ucfirst: function(str) {
  466.                         if (str) {
  467.                             return str.charAt(0).toUpperCase() + str.slice(1);
  468.                         }
  469.                         return '';
  470.                     },
  471.                     ucwords: function(str) {
  472.                         return str.replace(/(?:^|\s)\S/g, function(a) {
  473.                             return a.toUpperCase();
  474.                         })
  475.                     },
  476.                     dispDom: function(domain, adsense, first, db_pref_custom, target, href, donotcutdomain) {
  477.                         var isIP = false;
  478.                         if (domain instanceof Array) {
  479.                             isIP = domain[0] ? false : true;
  480.                             domain = domain[0] || this.parseDomainFromURL(domain[1]);
  481.                         }
  482.                         var db_pref = (typeof db_pref_custom != "undefined") ? db_pref_custom : app.conf.DB_PREFIX;
  483.                         var target = (typeof target != "undefined") ? ' target="' + target + '"' : '';
  484.                         href = (typeof href != "undefined") ? href : "";
  485.                         var isSetDomain = (domain.length > 0)
  486.                           , ret = '<td';
  487.                         if (first == 1) {
  488.                             ret += ' class="sem-widget-table-first-col left"';
  489.                         }
  490.                         if (!isSetDomain) {
  491.                             ret += ' align="center"';
  492.                         }
  493.                         ret += '>';
  494.                         if (isSetDomain) {
  495.                             if (typeof donotcutdomain == "undefined" || donotcutdomain == false) {
  496.                                 ret += '<nobr>';
  497.                             }
  498.                             ret += '<a href="http://' + domain + '/" class="sem-widget-url-img" title="' + domain + '" target="_blank" rel="nofollow noopener noreferrer"></a>&nbsp;';
  499.                             if (!isIP) {
  500.                                 ret += '<a class="sem-widget-url-cell" href="' + db_pref + app.conf.DB_DATE_PREFIX + '/info/' + domain + href + '" title="' + domain + '"' + target + '>';
  501.                             }
  502.                             if (typeof donotcutdomain == "undefined" || donotcutdomain == false) {
  503.                                 ret += this.clipString4(domain, 25);
  504.                             } else {
  505.                                 ret += domain;
  506.                             }
  507.                             if (!isIP) {
  508.                                 ret += '</a>&nbsp;&nbsp;';
  509.                             }
  510.                             if (typeof donotcutdomain == "undefined" || donotcutdomain == false) {
  511.                                 ret += '</nobr>';
  512.                             }
  513.                         } else {
  514.                             ret += this.displayLimits();
  515.                         }
  516.                         ret += '</td>';
  517.                         return ret;
  518.                     },
  519.                     addHttp: function(url) {
  520.                         var ret;
  521.                         if (url.substring(0, 7) != 'http://' && url.substring(0, 8) != 'https://') {
  522.                             ret = 'http://' + url;
  523.                         } else {
  524.                             ret = url;
  525.                         }
  526.                         return ret
  527.                     },
  528.                     addHttps: function(url) {
  529.                         if (/^(http|https|\/\/)/.test(url) === true) {
  530.                             return url;
  531.                         }
  532.                         return 'https://' + url;
  533.                     },
  534.                     dispDomain: function(domain, db_pref_custom, target, href, donotcutdomain, addClass) {
  535.                         var isIP = false;
  536.                         if (domain instanceof Array) {
  537.                             isIP = domain[0] ? false : true;
  538.                             domain = domain[0] || this.parseDomainFromURL(domain[1]);
  539.                         }
  540.                         var db_pref = (typeof db_pref_custom != "undefined") ? db_pref_custom : app.conf.DB_PREFIX;
  541.                         var target = (typeof target != "undefined") ? ' target="' + target + '"' : '';
  542.                         href = (typeof href != "undefined") ? href : "";
  543.                         var isSetDomain = (domain.length > 0)
  544.                           , ret = '<td';
  545.                         if (addClass) {
  546.                             ret += ' class="' + addClass + '"';
  547.                         }
  548.                         if (!isSetDomain) {
  549.                             ret += ' align="center"';
  550.                         }
  551.                         ret += '>';
  552.                         if (isSetDomain) {
  553.                             if (!isIP) {
  554.                                 ret += '<a href="' + db_pref + app.conf.DB_DATE_PREFIX + '/info/' + domain + href + '" title="' + domain + '"' + target + '>';
  555.                             }
  556.                             if (typeof donotcutdomain == "undefined" || donotcutdomain == false) {
  557.                                 ret += this.clipString4(domain, 25);
  558.                             } else {
  559.                                 ret += domain;
  560.                             }
  561.                             if (!isIP) {
  562.                                 ret += '</a>&nbsp;&nbsp;';
  563.                             }
  564.                         } else {
  565.                             ret += this.displayLimits();
  566.                         }
  567.                         ret += '</td>';
  568.                         return ret;
  569.                     },
  570.                     dispSearchEngine: function(engine, donotcut, addClass) {
  571.                         var isSetNetwork = (engine.length > 0)
  572.                           , ret = '<td';
  573.                         if (addClass) {
  574.                             ret += ' class="' + addClass + '"';
  575.                         }
  576.                         if (!isSetNetwork) {
  577.                             ret += ' align="center"';
  578.                         }
  579.                         ret += '>';
  580.                         if (isSetNetwork) {
  581.                             if (typeof donotcut == "undefined" || donotcut == false) {
  582.                                 ret += this.clipString4(engine, 25);
  583.                             } else {
  584.                                 ret += engine;
  585.                             }
  586.                         } else {
  587.                             ret += this.displayLimits();
  588.                         }
  589.                         ret += '</td>';
  590.                         return ret;
  591.                     },
  592.                     dispSocialNetwork: function(network, donotcut, addClass) {
  593.                         var isSetNetwork = (network.length > 0)
  594.                           , ret = '<td';
  595.                         if (addClass) {
  596.                             ret += ' class="' + addClass + '"';
  597.                         }
  598.                         if (!isSetNetwork) {
  599.                             ret += ' align="center"';
  600.                         }
  601.                         ret += '>';
  602.                         if (isSetNetwork) {
  603.                             if (typeof donotcut == "undefined" || donotcut == false) {
  604.                                 ret += this.clipString4(network, 25);
  605.                             } else {
  606.                                 ret += network;
  607.                             }
  608.                         } else {
  609.                             ret += this.displayLimits();
  610.                         }
  611.                         ret += '</td>';
  612.                         return ret;
  613.                     },
  614.                     dispTrafficKeywordCell: function(keyword, addClass, undefinedKeyword, undefinedTooltip) {
  615.                         var isSetKeyword = (keyword.length > 0)
  616.                           , ret = '<td';
  617.                         if (addClass) {
  618.                             ret += ' class="' + addClass + '"';
  619.                         }
  620.                         if (!isSetKeyword) {
  621.                             ret += ' align="center"';
  622.                         }
  623.                         ret += '>';
  624.                         if (isSetKeyword) {
  625.                             ret += this.dispTrafficKeyword(keyword[0], undefinedKeyword, undefinedTooltip);
  626.                         } else {
  627.                             ret += this.displayLimits();
  628.                         }
  629.                         ret += '</td>';
  630.                         return ret;
  631.                     },
  632.                     dispTrafficKeyword: function(keyword, undefinedKeyword, undefinedTooltip) {
  633.                         if (keyword === '') {
  634.                             keyword = '<span style="font-style: italic;" ' + (undefinedTooltip ? ' title="' + undefinedTooltip + '"' : '') + '>' + undefinedKeyword + '</span>';
  635.                         } else if (keyword.length > 50) {
  636.                             keyword = "<span title='" + keyword + "'>" + this.clipString4(keyword, 50) + "</span>";
  637.                         }
  638.                         return keyword;
  639.                     },
  640.                     dispSubdomain: function(domain, donotcutdomain, addClass) {
  641.                         var isIP = false;
  642.                         if (domain instanceof Array) {
  643.                             isIP = domain[0] ? false : true;
  644.                             domain = domain[0] || this.parseDomainFromURL(domain[1]);
  645.                         }
  646.                         var db_pref = (typeof db_pref_custom != "undefined") ? db_pref_custom : app.conf.DB_PREFIX;
  647.                         href = (typeof href != "undefined") ? href : "";
  648.                         var isSetDomain = (domain.length > 0)
  649.                           , ret = '<td';
  650.                         if (addClass) {
  651.                             ret += ' class="' + addClass + '"';
  652.                         }
  653.                         if (!isSetDomain) {
  654.                             ret += ' align="center"';
  655.                         }
  656.                         ret += '>';
  657.                         if (isSetDomain) {
  658.                             if (typeof donotcutdomain == "undefined" || donotcutdomain == false) {
  659.                                 ret += this.clipString4(domain, 25);
  660.                             } else {
  661.                                 ret += domain;
  662.                             }
  663.                         } else {
  664.                             ret += this.displayLimits();
  665.                         }
  666.                         ret += '</td>';
  667.                         return ret;
  668.                     },
  669.                     displayLink: function(domain, href, display_text, db_pref_custom, donotcutdomain, target) {
  670.                         var isIP = false;
  671.                         if (domain instanceof Array) {
  672.                             isIP = domain[0] ? false : true;
  673.                             domain = domain[0] || this.parseDomainFromURL(domain[1]);
  674.                         }
  675.                         var display_text = (typeof display_text != "undefined" && display_text) ? display_text : domain;
  676.                         var db_pref = (typeof db_pref_custom != "undefined" && db_pref_custom) ? db_pref_custom : app.conf.DB_PREFIX;
  677.                         var target = (typeof target != "undefined" && target) ? ' target="' + target + '"' : '';
  678.                         href = (typeof href != "undefined" && href) ? href : "";
  679.                         var isSetDomain = (domain.length > 0)
  680.                           , ret = '';
  681.                         if (isSetDomain) {
  682.                             if (!isIP) {
  683.                                 ret += '<a href="' + db_pref + app.conf.DB_DATE_PREFIX + '/info/' + domain + href + '" title="' + display_text + '"' + target + '>';
  684.                             }
  685.                             if (typeof donotcutdomain == "undefined" || donotcutdomain == false) {
  686.                                 ret += this.clipString4(display_text, 25);
  687.                             } else {
  688.                                 ret += display_text;
  689.                             }
  690.                             if (!isIP) {
  691.                                 ret += '</a>';
  692.                             }
  693.                         }
  694.                         return ret;
  695.                     },
  696.                     dispDomainValue: function(domain, db_pref_custom, donotcutdomain) {
  697.                         var isIP = false;
  698.                         if (domain instanceof Array) {
  699.                             isIP = domain[0] ? false : true;
  700.                             domain = domain[0] || this.parseDomainFromURL(domain[1]);
  701.                         }
  702.                         var isSetDomain = (domain.length > 0)
  703.                           , ret = '';
  704.                         if (isSetDomain) {
  705.                             if (typeof donotcutdomain == "undefined" || donotcutdomain == false) {
  706.                                 ret += this.clipString4(domain, 25);
  707.                             } else {
  708.                                 ret += domain;
  709.                             }
  710.                         }
  711.                         return ret;
  712.                     },
  713.                     parseDomainFromURL: function(url) {
  714.                         var reg = new RegExp("(https?://)?([^/]*)(/.*)","i");
  715.                         var res = reg.exec(url);
  716.                         return res[2];
  717.                     },
  718.                     dispOr: function(value, domain) {
  719.                         var ret = '<td align="right" class="right" style="white-space: nowrap !important;">';
  720.                         if (typeof value == "undefined" || value == null) {
  721.                             ret += '-';
  722.                         } else if (parseInt(value) == 0) {
  723.                             ret += value;
  724.                         } else {
  725.                             ret += '<a href="' + app.conf.DB_PREFIX + app.conf.DB_DATE_PREFIX + '/info/' + domain + '+(by+organic)">' + value + '</a>';
  726.                         }
  727.                         ret += '</td>';
  728.                         return ret;
  729.                     },
  730.                     dispAd: function(value, domain) {
  731.                         var ret = '<td align="right" class="right" style="white-space: nowrap !important;">';
  732.                         if (typeof value == "undefined" || value == null) {
  733.                             ret += '-';
  734.                         } else if (parseInt(value) == 0) {
  735.                             ret += value;
  736.                         } else {
  737.                             ret += '<a href="' + app.conf.DB_PREFIX + app.conf.DB_DATE_PREFIX + '/info/' + domain + '+(by+adwords)">' + value + '</a>';
  738.                         }
  739.                         ret += '</td>';
  740.                         return ret;
  741.                     },
  742.                     dispTr: function(traffic, previousTraffic, sorted, addClass) {
  743.                         var ret = '<td align="right" style="white-space: nowrap !important;" class="right ';
  744.                         if (typeof sorted != "undefined" && sorted) {
  745.                             ret += 'sem-widget-sorted-td';
  746.                         }
  747.                         if (typeof addClass != "undefined" && addClass) {
  748.                             ret += ' ' + addClass;
  749.                         }
  750.                         ret += '">';
  751.                         ret += (typeof traffic == "undefined" || traffic == null) ? '-' : traffic;
  752.                         if (typeof previousTraffic != "undefined" && previousTraffic != null) {
  753.                             ret += ' <span style="font-size:10px; color:#555;">(' + previousTraffic + ')</span>';
  754.                         }
  755.                         ret += '</td>';
  756.                         return ret;
  757.                     },
  758.                     dispTr1: function(value, previousValue, sorted, ts, cellPosition, searchField, reportType) {
  759.                         Date.now = Date.now || function() {
  760.                             return +new Date;
  761.                         }
  762.                         var ret = '<td class="';
  763.                         ret += (cellPosition ? cellPosition : 'right') + ' ';
  764.                         if (value > 100 && Date.now() - ts * 1000 <= 24 * 3600 * 1000) {
  765.                             ret += ' sem-report-super-traffic';
  766.                         } else if (typeof sorted != "undefined" && sorted) {
  767.                             ret += ' sem-widget-sorted-td';
  768.                         }
  769.                         ret += '">';
  770.                         if (value > 100 && Date.now() - ts * 1000 <= 24 * 3600 * 1000) {
  771.                             ret += '<div class="sem-report-with-tooltip">';
  772.                         }
  773.                         if (typeof searchField != "undefined" && searchField) {
  774.                             ret += '<a class="sem-widget-cell-link" href="' + app.conf.DB_PREFIX + app.conf.DB_DATE_PREFIX + '/info/' + encodeURIComponent(searchField) + '+' + reportType + '">';
  775.                         }
  776.                         ret += (typeof value == "undefined" || value == null) ? '-' : this.dispTraffic(value);
  777.                         if (typeof searchField != "undefined" && searchField) {
  778.                             ret += "</a>";
  779.                         }
  780.                         if (typeof previousValue != "undefined" && previousValue != null) {
  781.                             ret += ' <span style="font-size:10px; color:#555;">(' + previousValue + ')</span>';
  782.                         }
  783.                         if (value > 100 && Date.now() - ts * 1000 <= 24 * 3600 * 1000) {
  784.                             ret += '<div class="sem-report-tooltip-right">This keyword was recently updated, and isn’t included in the domain’s traffic statistics. At this time, expected monthly traffic from the given keyword to the website is higher than all traffic that the domain could get, and the percentage overruns 100%. With a new update, traffic share of the given keyword will be included in domain’s traffic share, and percentage will be no longer more than 100%.</div></div>';
  785.                         }
  786.                         ret += '</td>';
  787.                         return ret;
  788.                     },
  789.                     dispTraffic: function(traffic) {
  790.                         if (Math.ceil((parseFloat(traffic) * 100) / 100) === 0) {
  791.                             return "< 0.01";
  792.                         }
  793.                         return traffic;
  794.                     },
  795.                     dispTrBar: function(traffic) {
  796.                         var ret = '<td>';
  797.                         ret += '<div class="sem-report-bar" title="' + (traffic == 0 ? '< 0.01' : traffic) + '%"><div class="sem-report-bar-fill" style="width: ' + traffic + '%;"></div></div>';
  798.                         ret += '</td>';
  799.                         return ret;
  800.                     },
  801.                     dispTc: function(costs, previousCosts, sorted, addClass) {
  802.                         var ret = '<td align="right" style="white-space: nowrap !important;" class="right ';
  803.                         if (typeof sorted != "undefined" && sorted) {
  804.                             ret += 'sem-widget-sorted-td';
  805.                         }
  806.                         if (typeof addClass != "undefined" && addClass) {
  807.                             ret += ' ' + addClass;
  808.                         }
  809.                         ret += '">';
  810.                         ret += (typeof costs == "undefined" || costs == null) ? '-' : costs;
  811.                         if (typeof previousCosts != "undefined" && previousCosts != null) {
  812.                             ret += ' <span style="font-size:10px; color:#555;">(' + previousCosts + ')</span>';
  813.                         }
  814.                         ret += '</td>';
  815.                         return ret;
  816.                     },
  817.                     dispMinValue: function(value, minValue, sorted, addClass) {
  818.                         var cellValue = '-';
  819.                         if (typeof value != "undefined" && value) {
  820.                             value = parseInt(value);
  821.                             if (typeof minValue != "undefined" && minValue && parseInt(value) < minValue) {
  822.                                 cellValue = '< ' + minValue;
  823.                             } else {
  824.                                 cellValue = this.breakToThreeComa(value);
  825.                             }
  826.                         }
  827.                         return this.dispTableCell(cellValue, sorted, addClass);
  828.                     },
  829.                     dispDefValue: function(value, sorted, addClass, defValue) {
  830.                         var cellValue = (typeof defValue !== 'undefined') ? defValue : '-';
  831.                         if (typeof value != "undefined" && parseInt(value)) {
  832.                             cellValue = this.breakToThreeComa(value);
  833.                         }
  834.                         return this.dispTableCell(cellValue, sorted, addClass);
  835.                     },
  836.                     dispTableCell: function(value, sorted, addClass) {
  837.                         var ret = '<td align="right" style="white-space: nowrap !important;"';
  838.                         ret += 'class="' + this._cellClass(sorted, addClass) + '">';
  839.                         ret += (typeof value == "undefined" || value == null) ? '-' : value;
  840.                         ret += '</td>';
  841.                         return ret;
  842.                     },
  843.                     _cellClass: function(sorted, addClass) {
  844.                         var cellClass = ['right'];
  845.                         if (typeof sorted != "undefined" && sorted) {
  846.                             cellClass.push('sem-widget-sorted-td');
  847.                         }
  848.                         if (typeof addClass != "undefined" && addClass) {
  849.                             cellClass.push(addClass);
  850.                         }
  851.                         return cellClass.join(' ');
  852.                     },
  853.                     dispValue: function(value, previousValue, sorted, additionalClass) {
  854.                         var ret = '<td align="right" style="white-space: nowrap !important;" class="right ';
  855.                         if (typeof sorted != "undefined" && sorted) {
  856.                             ret += ' sem-widget-sorted-td';
  857.                         }
  858.                         if (typeof additionalClass != "undefined" && additionalClass) {
  859.                             ret += ' ' + additionalClass;
  860.                         }
  861.                         ret += '">';
  862.                         ret += (typeof value == "undefined" || value == null) ? '-' : value;
  863.                         if (typeof previousValue != "undefined" && previousValue != null) {
  864.                             ret += ' <span style="font-size:10px; color:#555;">(' + previousValue + ')</span>';
  865.                         }
  866.                         ret += '</td>';
  867.                         return ret;
  868.                     },
  869.                     dispTextValue: function(value, sorted) {
  870.                         var ret = '<td style="text-align: left; white-space: nowrap !important;"';
  871.                         if (typeof sorted != "undefined" && sorted) {
  872.                             ret += ' class="sem-widget-sorted-td"';
  873.                         }
  874.                         ret += ">";
  875.                         ret += (typeof value == "undefined" || value == null) ? "" : value;
  876.                         ret += "</td>";
  877.                         return ret;
  878.                     },
  879.                     dispLinkValue: function(value, sorted, searchField, reportType) {
  880.                         var ret = '<td style="text-align: center; white-space: nowrap !important;"';
  881.                         if (typeof sorted != "undefined" && sorted) {
  882.                             ret += ' class="sem-widget-sorted-td"';
  883.                         }
  884.                         ret += ">";
  885.                         if (typeof searchField != "undefined" && searchField) {
  886.                             ret += '<a class="sem-widget-cell-link" href="' + app.conf.DB_PREFIX + app.conf.DB_DATE_PREFIX + '/info/' + encodeURIComponent(searchField) + '+' + reportType + '">';
  887.                         }
  888.                         if (typeof value != "undefined" && parseInt(value)) {
  889.                             ret += this.breakToThreeComa(value);
  890.                         }
  891.                         if (typeof searchField != "undefined" && searchField) {
  892.                             ret += '</a>';
  893.                         }
  894.                         ret += "</td>";
  895.                         return ret;
  896.                     },
  897.                     getCompRelevance: function(num, newdesign) {
  898.                         function rationalTanh(x) {
  899.                             if (x < -3)
  900.                                 return -1;
  901.                             else if (x > 3)
  902.                                 return 1;
  903.                             else
  904.                                 return x * (27 + x * x) / (27 + 9 * x * x);
  905.                         }
  906.                         var calculatedRelevance, relevance = parseFloat(num);
  907.                         if (relevance > 100) {
  908.                             relevance = 100;
  909.                         }
  910.                         if (relevance >= 0 && relevance < 7) {
  911.                             calculatedRelevance = 40 * rationalTanh((relevance - 5) / 2) + 40;
  912.                         } else {
  913.                             if (typeof newdesign != "undefined") {
  914.                                 calculatedRelevance = 60 * rationalTanh((relevance + 10) / 40) + 50;
  915.                             } else {
  916.                                 calculatedRelevance = 50 * rationalTanh((relevance + 10) / 40) + 50;
  917.                             }
  918.                         }
  919.                         if (calculatedRelevance > 100) {
  920.                             calculatedRelevance = 100;
  921.                         }
  922.                         return [calculatedRelevance, relevance];
  923.                     },
  924.                     dispCR: function(domain, num, sorted, newdesign) {
  925.                         var calculatedRelevance, relevance, compRelArr = this.getCompRelevance(num, newdesign);
  926.                         calculatedRelevance = compRelArr[0];
  927.                         relevance = compRelArr[1];
  928.                         var td = '<td';
  929.                         if (typeof sorted != "undefined" && sorted) {
  930.                             td += ' class="sem-widget-progress-bar-cell sem-widget-progress-bar-cell-comp sem-widget-sorted-td"';
  931.                         } else {
  932.                             td += ' class="sem-widget-progress-bar-cell sem-widget-progress-bar-cell-comp"';
  933.                         }
  934.                         if (domain.length > 0) {
  935.                             if (relevance < 0) {
  936.                                 td += '>N/A</td>';
  937.                             } else {
  938.                                 td += '><div class="sem-widget-progress-bar" title="' + Math.round(calculatedRelevance) + '%"><div style="width: ' + calculatedRelevance + '%;"></div></div></td>';
  939.                             }
  940.                         } else {
  941.                             td += '>' + this.displayLimits() + '</td>';
  942.                         }
  943.                         return td;
  944.                     },
  945.                     dispSimilarity: function(domain, similarity, sorted) {
  946.                         return this.dispCR(domain, similarity * 100, sorted, true);
  947.                     },
  948.                     dispTrafficShare: function(traffic, postfix) {
  949.                         var result = Math.round(parseFloat(traffic) * 100) / 100;
  950.                         if (!postfix) {
  951.                             postfix = ''
  952.                         }
  953.                         if (result === 0) {
  954.                             if (parseFloat(traffic) > 0.00001) {
  955.                                 result = "< 0.01" + postfix
  956.                             } else {
  957.                                 result = "-";
  958.                             }
  959.                         } else {
  960.                             if (Math.round(parseFloat(traffic)) - result == 0) {
  961.                                 result = result + '.00' + postfix
  962.                             } else if (Math.round(parseFloat(traffic) * 10) - result * 10 == 0) {
  963.                                 result = result + '0' + postfix
  964.                             } else {
  965.                                 result += postfix
  966.                             }
  967.                         }
  968.                         return result;
  969.                     },
  970.                     dispCKw: function(domain, main_domain, kws, request_type, sorted) {
  971.                         var ret = '<td class="right cl-display-com-keyword';
  972.                         if (typeof sorted != "undefined" && sorted) {
  973.                             ret += 'sem-widget-sorted-td';
  974.                         }
  975.                         ret += '"';
  976.                         if (domain.length > 0) {
  977.                             ret += 'align="right">';
  978.                             ret += '<a href="' + app.conf.DB_PREFIX + app.conf.DB_DATE_PREFIX + '/info/' + main_domain + '+*+' + domain + '+(by+' + request_type + ')">' + this.calcRound3(kws) + '</a>';
  979.                         } else {
  980.                             ret += 'align="center">';
  981.                             ret += this.displayLimits();
  982.                         }
  983.                         ret += "</td>";
  984.                         return ret;
  985.                     },
  986.                     replaceLG: function(input) {
  987.                         var output = input.replace(/&lt;b&gt;/gi, '');
  988.                         return output.replace(/&lt;\/b&gt;/gi, '');
  989.                     },
  990.                     dispURLImage: function(url, v_url, kw) {
  991.                         if (url instanceof Array)
  992.                             url = url[1];
  993.                         if (kw.length > 0) {
  994.                             return '<a class="sem-widget-url-img" href="' + url + '" target="_blank" title="' + url + '"></a>';
  995.                         }
  996.                         return;
  997.                     },
  998.                     dispURL: function(url, v_url, kw, wordWrap, noClip) {
  999.                         var isIP = false;
  1000.                         if (url instanceof Array) {
  1001.                             isIP = url[0] ? false : true;
  1002.                             url = url[1];
  1003.                         }
  1004.                         var ret = "";
  1005.                         if (kw.length > 0) {
  1006.                             ret += (!wordWrap) ? '<nobr>' : '';
  1007.                             if (url == v_url) {
  1008.                                 var adw_key = 0;
  1009.                                 var add_v_url = '';
  1010.                                 if (!noClip)
  1011.                                     ret += '<a class="sem-widget-url-img" href="' + url + '" target="_blank" title="' + url + '"></a>';
  1012.                                 if (!isIP) {
  1013.                                     ret += '<a href="' + app.conf.DB_PREFIX + app.conf.DB_DATE_PREFIX + '/info/' + encodeURIComponent(add_v_url + v_url) + '" title="' + v_url + '">';
  1014.                                 }
  1015.                                 ret += (noClip) ? v_url : this.clipString3(v_url, 30, adw_key);
  1016.                                 if (!isIP) {
  1017.                                     ret += '</a>';
  1018.                                 }
  1019.                             } else {
  1020.                                 adw_key = 1;
  1021.                                 if (v_url.substring(0, 7) != 'http://' && v_url.substring(0, 8) != 'https://') {
  1022.                                     var add_v_url = 'http://';
  1023.                                 } else {
  1024.                                     var add_v_url = '';
  1025.                                 }
  1026.                                 if (!noClip)
  1027.                                     ret += '<a class="sem-widget-url-img" href="' + (url) + '" target="_blank" title="' + url + '"></a>';
  1028.                                 if (!isIP) {
  1029.                                     ret += '<a href="' + app.conf.DB_PREFIX + app.conf.DB_DATE_PREFIX + '/info/' + encodeURIComponent(add_v_url + v_url) + '" title="' + v_url + '">';
  1030.                                 }
  1031.                                 ret += (noClip) ? v_url : this.clipString3(this.replaceLG(v_url), 25, adw_key);
  1032.                                 if (!isIP) {
  1033.                                     ret += '</a>';
  1034.                                 }
  1035.                             }
  1036.                             ret += (!wordWrap) ? '</nobr>' : '';
  1037.                         } else {
  1038.                             if (url != v_url && app.conf.UPLIM_ADW.length > 0) {
  1039.                                 ret += '<span class="sem-widget-small-note">' + app.conf.UPLIM_ADW + '</span>';
  1040.                             } else {
  1041.                                 ret += this.displayLimits();
  1042.                             }
  1043.                         }
  1044.                         return ret;
  1045.                     },
  1046.                     dispURL_: function(url, v_url, kw, wordWrap, noClip) {
  1047.                         var isIP = false;
  1048.                         if (url instanceof Array) {
  1049.                             isIP = url[0] ? false : true;
  1050.                             url = url[1];
  1051.                         }
  1052.                         var ret = "";
  1053.                         if (kw.length > 0) {
  1054.                             ret += (!wordWrap) ? '<nobr>' : '';
  1055.                             if (url == v_url) {
  1056.                                 var adw_key = 0;
  1057.                                 var add_v_url = '';
  1058.                                 if (!noClip)
  1059.                                     ret += '<a class="sem-widget-url-img" href="' + url + '" target="_blank" title="' + url + '"></a>';
  1060.                                 if (!isIP) {
  1061.                                     ret += '<a href="' + app.conf.DB_PREFIX + app.conf.DB_DATE_PREFIX + '/info/' + encodeURIComponent(add_v_url + v_url) + '" title="' + v_url + '">';
  1062.                                 }
  1063.                                 ret += (noClip) ? v_url : this.clipUrl(v_url, 150);
  1064.                                 if (!isIP) {
  1065.                                     ret += '</a>';
  1066.                                 }
  1067.                             } else {
  1068.                                 adw_key = 1;
  1069.                                 if (v_url.substring(0, 7) != 'http://' && v_url.substring(0, 8) != 'https://') {
  1070.                                     var add_v_url = 'http://';
  1071.                                 } else {
  1072.                                     var add_v_url = '';
  1073.                                 }
  1074.                                 if (!noClip)
  1075.                                     ret += '<a class="sem-widget-url-img" href="' + (url) + '" target="_blank" title="' + url + '"></a>';
  1076.                                 if (!isIP) {
  1077.                                     ret += '<a href="' + app.conf.DB_PREFIX + app.conf.DB_DATE_PREFIX + '/info/' + encodeURIComponent(add_v_url + v_url) + '" title="' + v_url + '">';
  1078.                                 }
  1079.                                 ret += (noClip) ? v_url : this.clipUrl(this.replaceLG(v_url), 150);
  1080.                                 if (!isIP) {
  1081.                                     ret += '</a>';
  1082.                                 }
  1083.                             }
  1084.                             ret += (!wordWrap) ? '</nobr>' : '';
  1085.                         } else {
  1086.                             if (url != v_url && app.conf.UPLIM_ADW.length > 0) {
  1087.                                 ret += '<span class="sem-widget-small-note">' + app.conf.UPLIM_ADW + '</span>';
  1088.                             } else {
  1089.                                 ret += this.displayLimits();
  1090.                             }
  1091.                         }
  1092.                         return ret;
  1093.                     },
  1094.                     dispKwPos: function(Po, Pp, sorted) {
  1095.                         var ret = '<td align="right" style="white-space:nowrap!important;"';
  1096.                         if (typeof sorted != "undefined" && sorted) {
  1097.                             ret += ' class="sem-widget-sorted-td"';
  1098.                         }
  1099.                         ret += '>';
  1100.                         ret += (Po == undefined || Po == null || Po == '0') ? '-' : Po;
  1101.                         ret += '<span class="pp-v2">';
  1102.                         if (Pp == undefined || Pp == null || Pp == '0') {
  1103.                             ret += '&nbsp;';
  1104.                         } else {
  1105.                             ret += '(' + Pp + ')';
  1106.                         }
  1107.                         ret += '</span></td>';
  1108.                         return ret;
  1109.                     },
  1110.                     dispAdwordsBlockWithoutLink: function(bl) {
  1111.                         var title;
  1112.                         switch (bl) {
  1113.                         case '***BOTTOM***':
  1114.                             bl = 'bottom';
  1115.                             title = "Bottom";
  1116.                             break;
  1117.                         case '***SIDE***':
  1118.                             bl = 'side';
  1119.                             title = "Side";
  1120.                             break;
  1121.                         case '***TOP***':
  1122.                             bl = 'top';
  1123.                             title = "Top";
  1124.                             break;
  1125.                         default:
  1126.                             return '-';
  1127.                         }
  1128.                         return '<i class="sem-report-adwords-block sem-report-adwords-block-' + bl + '" title="' + title + '"></i>';
  1129.                     },
  1130.                     dispAdwordsBlock: function(bl, kw, is_adwords, domain, position, timestamp, ignore_date_prefix) {
  1131.                         var a = '<a ', title;
  1132.                         switch (bl) {
  1133.                         case '***BOTTOM***':
  1134.                             bl = 'bottom';
  1135.                             title = "Bottom";
  1136.                             break;
  1137.                         case '***SIDE***':
  1138.                             bl = 'side';
  1139.                             title = "Side";
  1140.                             break;
  1141.                         case '***TOP***':
  1142.                             bl = 'top';
  1143.                             title = "Top";
  1144.                             break;
  1145.                         default:
  1146.                             return '-';
  1147.                         }
  1148.                         if (kw.length > 0) {
  1149.                             if (typeof ignore_date_prefix != "undefined" && ignore_date_prefix)
  1150.                                 a += 'target="_blank" href="' + app.conf.DB_PREFIX + "/info/" + encodeURIComponent(kw).replace(/%20/g, '+') + '+(source)';
  1151.                             else
  1152.                                 a += 'target="_blank" href="' + app.conf.DB_PREFIX + app.conf.DB_DATE_PREFIX + "/info/" + encodeURIComponent(kw).replace(/%20/g, '+') + '+(source)';
  1153.                             if (typeof domain != "undefined" && typeof position != "undefined") {
  1154.                                 a += '?domain=' + domain + '&position=' + position;
  1155.                                 if (is_adwords == 1) {
  1156.                                     a += '&type=adwords';
  1157.                                 }
  1158.                                 if (typeof timestamp != "undefined" && timestamp > 100000000) {
  1159.                                     a += '&ts=' + timestamp;
  1160.                                 }
  1161.                             } else if (typeof timestamp != "undefined" && timestamp > 100000000) {
  1162.                                 a += '?ts=' + timestamp;
  1163.                             }
  1164.                             a += '"';
  1165.                         } else {
  1166.                             a += 'target="_blank" href="' + app.conf.DB_PREFIX + '/limit_results/"' + app.conf.ADD_REG_FORM;
  1167.                         }
  1168.                         a += '><i class="sem-report-adwords-block sem-report-adwords-block-' + bl + '" title="' + title + '"></i></a>';
  1169.                         return a;
  1170.                     },
  1171.                     dispKwPosHistorical: function(Po, Pp, sorted, allowHistorical) {
  1172.                         var ret = '<td class="sem-widget-po-td';
  1173.                         if (typeof sorted != "undefined" && sorted) {
  1174.                             ret += ' sem-widget-sorted-td';
  1175.                         }
  1176.                         ret += ' nowrap">';
  1177.                         ret += '<span class="sem-widget-po-span sem-widget-po-value">';
  1178.                         ret += (Po == undefined || Po == null || Po == '0') ? '-' : Po;
  1179.                         ret += '</span>';
  1180.                         ret += '<span class="sem-widget-po-span sem-widget-pp-value">';
  1181.                         if (Pp == undefined || Pp == null || Pp == '0') {
  1182.                             ret += '&nbsp;';
  1183.                         } else {
  1184.                             ret += '(' + Pp + ')';
  1185.                         }
  1186.                         ret += '</span></td>';
  1187.                         return ret;
  1188.                     },
  1189.                     dispPosDif: function(Pd, sorted) {
  1190.                         var ret = '<td align="right" style="white-space:nowrap!important;';
  1191.                         if (Pd > 0) {
  1192.                             ret += 'color: #090; "';
  1193.                         } else if (Pd < 0) {
  1194.                             ret += 'color: #c00; "';
  1195.                         }
  1196.                         if (typeof sorted != "undefined" && sorted) {
  1197.                             ret += ' class="sem-widget-sorted-td"';
  1198.                         }
  1199.                         ret += '>';
  1200.                         ret += (Pd > 0) ? "+" + Pd : Pd;
  1201.                         ret += '</td>';
  1202.                         return ret;
  1203.                     },
  1204.                     dispPositions: function(Ps, index, sorted) {
  1205.                         var ret = '<td align="right" style="white-space: nowrap !important;"';
  1206.                         if (typeof sorted != "undefined" && sorted) {
  1207.                             ret += ' class="sem-widget-sorted-td"';
  1208.                         }
  1209.                         ret += '>';
  1210.                         ret += Ps.split(',')[index];
  1211.                         ret += '</td>';
  1212.                         return ret;
  1213.                     },
  1214.                     prependZero: function(value) {
  1215.                         return value < 10 ? "0" + value : value;
  1216.                     },
  1217.                     dispTimestamp: function(timestamp) {
  1218.                         var date, ret = "-";
  1219.                         if (timestamp) {
  1220.                             date = new Date(parseInt(timestamp, 10) * 1000);
  1221.                             ret = this.prependZero(date.getUTCHours()) + ":" + this.prependZero(date.getUTCMinutes()) + ":" + this.prependZero(date.getUTCSeconds()) + " " + this.prependZero(date.getUTCDate()) + "." + this.prependZero(date.getUTCMonth() + 1) + "." + date.getUTCFullYear();
  1222.                         }
  1223.                         return ret;
  1224.                     },
  1225.                     dispHumanDate: function(date) {
  1226.                         if (!date) {
  1227.                             return '-';
  1228.                         }
  1229.                         date = parseInt(date, 10);
  1230.                         Date.now = Date.now || function() {
  1231.                             return +new Date;
  1232.                         }
  1233.                         ;
  1234.                         var today = Math.round(Date.now() / 1000);
  1235.                         var difference = today - date;
  1236.                         if (difference < 0) {
  1237.                             return '-';
  1238.                         } else if (difference < 60) {
  1239.                             return difference + ' sec ago';
  1240.                         } else if (difference < 60 * 60) {
  1241.                             return Math.floor(difference / 60) + ' min ago';
  1242.                         } else if (difference < 24 * 60 * 60) {
  1243.                             return Math.floor(difference / 60 / 60) + ' hr ago';
  1244.                         } else if (difference < 7 * 24 * 60 * 60) {
  1245.                             difference = Math.floor(difference / 24 / 60 / 60);
  1246.                             return difference + ((difference == 1) ? ' day ago' : ' days ago');
  1247.                         } else if (difference < 30 * 24 * 60 * 60) {
  1248.                             date = new Date(date * 1000);
  1249.                             return date.getDate() + ' ' + app.conf.MONTH_SHORT_NAMES[date.getMonth()] + " " + date.getFullYear();
  1250.                         } else if (difference > 365 * 24 * 60 * 60) {
  1251.                             return '-';
  1252.                         } else {
  1253.                             date = new Date(date * 1000);
  1254.                             return app.conf.MONTH_SHORT_NAMES[date.getMonth()] + " " + date.getFullYear();
  1255.                         }
  1256.                     },
  1257.                     dispNqHistory: function(volumes, sorted, addClass) {
  1258.                         var Nq, ret = "";
  1259.                         if (typeof volumes[0] != "undefined") {
  1260.                             Nq = volumes[0]["Nq"];
  1261.                             ret += '<td align="right" style="white-space:nowrap!important;" class="right ';
  1262.                             if (typeof sorted != "undefined" && sorted) {
  1263.                                 ret += 'sem-widget-sorted-td';
  1264.                             }
  1265.                             if (typeof addClass != "undefined" && addClass) {
  1266.                                 ret += ' ' + addClass;
  1267.                             }
  1268.                             ret += '">' + ((Nq) ? this.breakToThreeComa(Nq) : 'n/a') + '</td>';
  1269.                         }
  1270.                         return ret;
  1271.                     },
  1272.                     dispCvHistory: function(cv, sorted) {
  1273.                         return '<td class="right ' + (typeof sorted != "undefined" ? 'sem-widget-sorted-td' : '') + '">' + cv + '</td>';
  1274.                     },
  1275.                     dispRkHistory: function(Rk, Hs, sorted) {
  1276.                         var ret = "";
  1277.                         if (typeof Hs[0] != "undefined") {
  1278.                             var ret = '<td align="right" style="white-space:nowrap!important;" class="sem-widget-offset-col';
  1279.                             if (typeof sorted != "undefined" && sorted) {
  1280.                                 ret += ' sem-widget-sorted-td';
  1281.                             }
  1282.                             ret += '">' + ((Rk) ? this.breakToThreeComa(Rk) : 'n/a') + '</td>';
  1283.                         }
  1284.                         return ret;
  1285.                     },
  1286.                     dispCPCHistory: function(cpcs, sorted) {
  1287.                         var Cp, ret = "";
  1288.                         if (typeof cpcs[0] != "undefined") {
  1289.                             Cp = cpcs[0]["Cp"];
  1290.                             if (!Cp && cpcs[0]["Nq"] != "") {
  1291.                                 Cp = "0.00";
  1292.                             }
  1293.                             ret += '<td align="right" style="white-space:nowrap!important;" class="right ';
  1294.                             if (typeof sorted != "undefined" && sorted) {
  1295.                                 ret += 'sem-widget-sorted-td';
  1296.                             }
  1297.                             ret += '">' + ((Cp != "") ? Cp : 'n/a') + '</td>';
  1298.                         }
  1299.                         return ret;
  1300.                     },
  1301.                     dispTrHistory: function(Tr, volumes, sorted, addClass) {
  1302.                         var hasVolume = true;
  1303.                         if (volumes && typeof volumes[0] != "undefined" && !volumes[0]["Nq"]) {
  1304.                             hasVolume = false;
  1305.                         }
  1306.                         var ret = '<td align="right" style="white-space:nowrap!important;" class="right ';
  1307.                         if (typeof sorted != "undefined" && sorted) {
  1308.                             ret += 'sem-widget-sorted-td';
  1309.                         }
  1310.                         if (typeof addClass != "undefined" && addClass) {
  1311.                             ret += ' ' + addClass;
  1312.                         }
  1313.                         ret += '">' + ((Tr && hasVolume) ? Tr : 'n/a') + '</td>';
  1314.                         return ret;
  1315.                     },
  1316.                     dispPositionHistory: function(positions, limit, title) {
  1317.                         var i = 0, Po, ret = "", td = "";
  1318.                         while (typeof positions[i] != "undefined") {
  1319.                             td = "";
  1320.                             Po = positions[i]["Po"];
  1321.                             td += '<td class="' + (i == (_.values(positions).length - 1) ? 'sem-widget-offset-col ' : '') + 'sem-widget-adwords-history-td';
  1322.                             if (Po > 0) {
  1323.                                 td += ' sem-widget-adwords-history-td-' + ((limit) ? " limit" : Po);
  1324.                                 td += '" rel="' + (_.values(positions).length - i) + '">';
  1325.                                 td += Po;
  1326.                             } else if (Po < 0) {
  1327.                                 td += '-empty"><div class="sem-widget-adwords-history-td-na"';
  1328.                                 if (typeof title != 'undefined') {
  1329.                                     td += ' title="' + title + '"';
  1330.                                 }
  1331.                                 td += '>&nbsp;</div>';
  1332.                             } else {
  1333.                                 td += '-empty"><div>&nbsp;</div>';
  1334.                             }
  1335.                             td += '</td>';
  1336.                             ret = td + ret;
  1337.                             i++;
  1338.                         }
  1339.                         return ret;
  1340.                     },
  1341.                     dispAds: function(ads, new_design) {
  1342.                         var previousMonth = 0;
  1343.                         spacerMonth = 0,
  1344.                         month = 0,
  1345.                         year = 0,
  1346.                         _this = this;
  1347.                         var length = _.values(ads).length
  1348.                           , ret = '<tr class="sem-widget-adwords-history-ads-tr">' + '<td colspan="' + (length + 5) + '">' + '<div class="sem-widget-adwords-history-ads-container-0">' + '<div class="sem-widget-adwords-history-ads-container-1">' + '<div class="sem-widget-adwords-history-ads-container">';
  1349.                         _.each(_.values(ads).reverse(), function(item, index) {
  1350.                             if (item["Po"] == "" || item["Po"] <= 0) {
  1351.                                 previousMonth = 0;
  1352.                                 return;
  1353.                             }
  1354.                             month = parseInt(item["Dt"].substr(4, 2), 10);
  1355.                             year = parseInt(item["Dt"].substr(0, 4), 10);
  1356.                             if (previousMonth == 0 && spacerMonth > 0) {
  1357.                                 var startMonth = (spacerMonth > 11) ? 1 : spacerMonth + 1;
  1358.                                 var startYear = (startMonth < month) ? year : year - 1;
  1359.                                 var endMonth = (month <= 1) ? 12 : month - 1;
  1360.                                 var endYear = (endMonth < month) ? year : year - 1;
  1361.                                 ret += '<div class="sem-widget-adwords-history-ad">' + '<div class="sem-widget-adwords-history-ad-container sem-widget-adwords-history-ad-spacer">' + '<div class="sem-widget-adwords-history-ad-date-empty">' + ((endMonth == startMonth) ? app.conf.MONTH_SHORT_NAMES[startMonth - 1] + ' ' + startYear : app.conf.MONTH_SHORT_NAMES[startMonth - 1] + ' ' + startYear + ' - ' + app.conf.MONTH_SHORT_NAMES[endMonth - 1] + ' ' + endYear) + '</div>' + '<div class="sem-widget-adwords-history-ad-spacer-content">&nbsp;</div>' + '</div></div>';
  1362.                             }
  1363.                             index = parseInt(index, 10) + 1;
  1364.                             item["Ds"] = item["Ds"].replace(/<table[^>]*>(.+)?<\/table>/ig, "");
  1365.                             item["Ds"] = item["Ds"].replace(/<span[^>]*>(.+)?<\/span>/ig, "");
  1366.                             item["Ds"] = item["Ds"].replace(/<a[^>]*>(.+)?<\/a>/ig, "");
  1367.                             item["Ds"] = item["Ds"].replace(/&nbsp;$/ig, "");
  1368.                             item["Ds"] = item["Ds"].replace(/<br>$/ig, "");
  1369.                             item["Ds"] = item["Ds"].replace(/<div[^>]*>/ig, "");
  1370.                             item["Ds"] = item["Ds"].replace(/<\/div>/ig, "");
  1371.                             if (item["Cp"] == "") {
  1372.                                 item["Cp"] = (item["Nq"] == "" ? "n/a" : "0.00");
  1373.                             }
  1374.                             ret += '<div class="sem-widget-adwords-history-ad sem-widget-adwords-history-ad-title-' + item["Po"] + ' sem-widget-adwords-history-ad-' + index + '" rel="' + index + '">' + '<div class="sem-widget-adwords-history-ad-container">' + '<div class="sem-widget-adwords-history-ad-date">' + app.conf.MONTH_NAMES[month - 1] + ' ' + year + '</div>' + '<div class="sem-widget-adwords-history-ad-text">';
  1375.                             if (typeof new_design !== "undefined") {
  1376.                                 ret += '<a href="' + item['Ur'] + '" target="_blank">' + item["Tt"] + '</a>' + '<div class="sem-widget-type-ads-domain" title="' + item['Vu'] + '"><span class="sem-report-block-ad">Ad</span>' + _this.clipString3(item["Vu"], 30, 0) + '</div>' + '<div>' + item["Ds"] + '</div>';
  1377.                             } else {
  1378.                                 ret += '<div class="ads-ln"><a href="' + item["Ur"] + '" target="_blank">' + item["Tt"] + '</a></div>' + '<div class="ads-d">' + item["Ds"] + '</div>' + '<cite class="ads-cite">' + _this.clipString3(item["Vu"], 30, 0) + '</cite>';
  1379.                             }
  1380.                             ret += '</div>' + ((typeof item["Nq"] != "undefined" && typeof item["Cp"] != "undefined") ? '<div class="sem-widget-adwords-history-ad-values"><div>Volume: ' + _this.breakToThreeComa(item["Nq"]) + '; CPC: ' + item["Cp"] + '</div></div>' : '') + '</div></div>';
  1381.                             spacerMonth = parseInt(item["Dt"].substr(4, 2), 10);
  1382.                             previousMonth = spacerMonth;
  1383.                         });
  1384.                         ret += '<div style="clear: both;"></div></div></div></div></td></tr>';
  1385.                         return ret;
  1386.                     },
  1387.                     dispRoundNum: function(num, addClass) {
  1388.                         var cellClass = "right";
  1389.                         if (typeof addClass != "undefined" && addClass) {
  1390.                             cellClass += ' ' + addClass;
  1391.                         }
  1392.                         return '<td class="' + cellClass + '" align="right">' + this.calcRound3(num) + '</td>';
  1393.                     },
  1394.                     dispRoundNumWithA: function(num, path, addClass) {
  1395.                         var cellClass = "right";
  1396.                         if (typeof addClass != "undefined" && addClass) {
  1397.                             cellClass += ' ' + addClass;
  1398.                         }
  1399.                         var ret = '<td class="' + cellClass + '" align="right">';
  1400.                         ret += '<a href="' + path + '">' + this.calcRound3(num) + '</a>';
  1401.                         return ret + '</td>';
  1402.                     },
  1403.                     dispKw: function(kw, first, db_pref_custom, target, href, hasFeatures, options) {
  1404.                         if (hasFeatures) {
  1405.                             return this.dispKwFeatures(kw, first, db_pref_custom, target, href, options);
  1406.                         }
  1407.                         var db_pref = (typeof db_pref_custom != "undefined") ? db_pref_custom : app.conf.DB_PREFIX;
  1408.                         var target = (typeof target != "undefined") ? ' target="' + target + '"' : '';
  1409.                         href = (typeof href != "undefined") ? href : " (keyword)";
  1410.                         var ret = '<td class="left cl-table-cell_keyword' + ((first == 0) ? ' sem-widget-table-first-col' : '') + '"';
  1411.                         if (kw.length > 0) {
  1412.                             ret += '><a href="' + db_pref + app.conf.DB_DATE_PREFIX + '/info/' + kw + href + '"' + target + '>' + this.clipWord(kw, 30) + '</a>';
  1413.                         } else {
  1414.                             ret += ' align="center">';
  1415.                             ret += this.displayLimits();
  1416.                         }
  1417.                         ret += "</td>"
  1418.                         return ret;
  1419.                     },
  1420.                     dispKwFeatures: function(kw, first, db_pref_custom, target, href, options) {
  1421.                         var db_pref = (typeof db_pref_custom != "undefined") ? db_pref_custom : app.conf.DB_PREFIX;
  1422.                         var target = (typeof target != "undefined") ? ' target="' + target + '"' : '';
  1423.                         href = (typeof href != "undefined") ? href : " (keyword)";
  1424.                         options = options || {};
  1425.                         var ret = '<td class="left cl-table-cell_keyword' + ((first == 0) ? ' sem-widget-table-first-col' : '') + '"';
  1426.                         if (kw.length > 0) {
  1427.                             ret += '><div class="sem-report-with-tooltip">';
  1428.                             ret += '<a href="' + db_pref + app.conf.DB_DATE_PREFIX + '/info/' + kw + href + '"' + target + '>' + this.clipWord(kw, 30) + '</a>';
  1429.                             ret += '<div class="sem-report-tooltip-right cell-tooltip">';
  1430.                             if (options.locale && options.categories) {
  1431.                                 ret += '<p>' + options.locale.categories + '</p>';
  1432.                                 ret += '<ul style="text-align: left; margin-bottom: 5px">';
  1433.                                 ret += _.map(options.categories, function(value) {
  1434.                                     return '<li>' + options.locale['filters_Ca_' + value] + '</li>';
  1435.                                 }).join('');
  1436.                                 ret += '</ul>';
  1437.                             }
  1438.                             if (options.locale && options.serpfeatures) {
  1439.                                 ret += '<p style="white-space:nowrap;">' + options.locale.serp_features + '</p>';
  1440.                                 ret += '<ul style="text-align: left">';
  1441.                                 ret += _.map(options.serpfeatures, function(value) {
  1442.                                     var item = '<li>';
  1443.                                     if (value < 0) {
  1444.                                         item += options.locale['filters_Fl_' + Math.abs(value)] + ' (' + options.locale.serp_features_note + ')';
  1445.                                     } else {
  1446.                                         item += options.locale['filters_Fl_' + value];
  1447.                                     }
  1448.                                     return item + '</li>';
  1449.                                 }).join('');
  1450.                                 ret += '</ul>';
  1451.                             }
  1452.                             ret += '</div></div>';
  1453.                         } else {
  1454.                             ret += ' align="center">';
  1455.                             ret += this.displayLimits();
  1456.                         }
  1457.                         ret += "</td>"
  1458.                         return ret;
  1459.                     },
  1460.                     roundNumRankNew: function(i) {
  1461.                         i = parseInt(i, 10);
  1462.                         if (isNaN(i))
  1463.                             return 0;
  1464.                         if (i < 1000)
  1465.                             return i;
  1466.                         else if (i < 1000000)
  1467.                             return (i / 1000).toFixed(1) + 'k';
  1468.                         else if (i < 1000000000)
  1469.                             return (i / 1000000).toFixed(1) + 'm';
  1470.                         else
  1471.                             return (i / 1000000000).toFixed(1) + 'b';
  1472.                     },
  1473.                     roundNumRankFormatted: function(i, prefix, helpOverlay, helpOverlayPosition) {
  1474.                         i = parseInt(i, 10);
  1475.                         var ret = ''
  1476.                           , ho = '';
  1477.                         if (typeof prefix == "undefined")
  1478.                             prefix = '';
  1479.                         if (helpOverlay && helpOverlayPosition) {
  1480.                             ho = "data-helpoverlay='" + helpOverlay + "' data-helpoverlay-position='" + helpOverlayPosition + "'";
  1481.                         }
  1482.                         if (isNaN(i))
  1483.                             i = 0;
  1484.                         if (i < 1000)
  1485.                             ret = prefix + i;
  1486.                         else if (i < 1000000)
  1487.                             ret = prefix + (i / 1000).toFixed((i / 1000) > 100 ? 0 : 1) + 'K';
  1488.                         else if (i < 1000000000)
  1489.                             ret = prefix + (i / 1000000).toFixed((i / 1000000) > 100 ? 0 : 1) + 'M';
  1490.                         else
  1491.                             ret = prefix + (i / 1000000000).toFixed((i / 1000000000) > 100 ? 0 : 1) + 'B';
  1492.                         return "<span class='sem-report-counter'><strong " + ho + ">" + ret + "</strong></span>";
  1493.                     },
  1494.                     roundNumRank: function(i) {
  1495.                         i = parseInt(i, 10);
  1496.                         if (isNaN(i))
  1497.                             return 0;
  1498.                         if (i < 1000)
  1499.                             return i;
  1500.                         else if (i < 1000000)
  1501.                             return (i / 1000).toFixed((i / 1000) > 100 ? 0 : 1) + 'K';
  1502.                         else if (i < 1000000000)
  1503.                             return (i / 1000000).toFixed((i / 1000000) > 100 ? 0 : 1) + 'M';
  1504.                         else
  1505.                             return (i / 1000000000).toFixed((i / 1000000000) > 100 ? 0 : 1) + 'B';
  1506.                     },
  1507.                     getUsersCurrency: function() {
  1508.                         var currency = cookiesUtils.getCookie("currency");
  1509.                         return (typeof currency != 'undefined') ? currency : 'usd';
  1510.                     },
  1511.                     formatPriceRoundNum: function(val, db_currency) {
  1512.                         return this.formatPrice(this.roundNumRank(val), db_currency);
  1513.                     },
  1514.                     formatPrice: function(val, db_currency) {
  1515.                         return this.formatCurrency.formatStringByCode(val, db_currency);
  1516.                     },
  1517.                     replaceAdvDescription: function(text) {
  1518.                         if (text != undefined) {
  1519.                             text = text.replace(/<span[^>]*>(.+)?<\/span>/ig, "");
  1520.                             text = text.replace(/<a[^>]*>(.+)?<\/a>/ig, "");
  1521.                             if (text.match(/<table[^>]*>/ig) && !text.match(/<\/table>/ig)) {
  1522.                                 text = '';
  1523.                             }
  1524.                             text = text.replace(/<table[^>]*>(.+)?<\/table>/ig, "");
  1525.                             text = text.replace(/&nbsp;$/ig, "");
  1526.                             text = text.replace(/<br>$/ig, "");
  1527.                         }
  1528.                         return text;
  1529.                     },
  1530.                     dispKeywordDifficulty: function(diff, sorted) {
  1531.                         var ret = '<td class="sem-widget-kw-diff ';
  1532.                         if (typeof sorted != "undefined" && sorted) {
  1533.                             ret += ' sem-widget-sorted-td';
  1534.                         }
  1535.                         ret += '">';
  1536.                         if (diff && diff > 0) {
  1537.                             ret += diff;
  1538.                         } else {
  1539.                             ret += '-';
  1540.                         }
  1541.                         ret += '</td>';
  1542.                         return ret;
  1543.                     },
  1544.                     makeTrend: function(trend) {
  1545.                         var trends = ''
  1546.                           , foo = '<ul class="trends-chart">';
  1547.                         if (typeof trend != "undefined" && trend.length != 0) {
  1548.                             $.each(trend.split(','), function(j, trend_block) {
  1549.                                 trends += '<li class="trend-bg-color" style="height: ' + (trend_block * 20) + 'px;"></li>';
  1550.                             });
  1551.                         }
  1552.                         return '<td class="sem-minwidth-td" style="text-align: center;">' + foo + trends + '</ul></td>';
  1553.                     },
  1554.                     dispSource: function(kw, is_adwords, domain, position, timestamp, ignore_date_prefix) {
  1555.                         var a = '<a class="serp-link" target="_blank" ';
  1556.                         if (!kw.length) {
  1557.                             return a + 'data-serp="limit" href="/limit_results/"' + app.conf.ADD_REG_FORM + '>&nbsp;</a>';
  1558.                         }
  1559.                         a += "data-serp='link' onclick=\"ga('send', 'event', 'DPA', 'SERP icon clicked at " + app.conf.REPORT_TYPE + "', 'DB " + (app.conf.DB_DATE_PREFIX ? (app.conf.DB_DATE_PREFIX).replace('/', '') : 'US') + "')\" ";
  1560.                         var href = app.conf.DB_PREFIX;
  1561.                         if (typeof ignore_date_prefix == "undefined" || !ignore_date_prefix) {
  1562.                             href += app.conf.DB_DATE_PREFIX;
  1563.                         }
  1564.                         href += "/info/" + encodeURIComponent(kw) + "+(source)";
  1565.                         var hrefParams = {};
  1566.                         if (typeof domain != "undefined" && typeof position != "undefined") {
  1567.                             hrefParams.domain = domain;
  1568.                             if (is_adwords !== 1) {
  1569.                                 hrefParams.position = parseInt(position);
  1570.                             }
  1571.                             if (is_adwords == 1) {
  1572.                                 hrefParams.type = 'adwords';
  1573.                             } else if (is_adwords == 2) {
  1574.                                 hrefParams.type = 'shopping';
  1575.                             }
  1576.                         }
  1577.                         if (typeof timestamp != "undefined" && timestamp > 100000000) {
  1578.                             hrefParams.ts = timestamp;
  1579.                         }
  1580.                         if ((_.keys(hrefParams)).length) {
  1581.                             href += '?' + $.param(hrefParams);
  1582.                         }
  1583.                         a += ' href="' + href + '">&nbsp;</a>';
  1584.                         return a;
  1585.                     },
  1586.                     showSerpExpired: function(db_date) {
  1587.                         if (db_date == 'current') {
  1588.                             return true;
  1589.                         }
  1590.                         var expired_date = moment().subtract(3, 'month').format('YYYYMM');
  1591.                         return (expired_date < db_date);
  1592.                     },
  1593.                     dispDifference: function(difference, value, sorted, clipped) {
  1594.                         var diff, upDown, classes = "", ret = "";
  1595.                         if (difference == 0)
  1596.                             diff = '0%';
  1597.                         else if (value == difference)
  1598.                             diff = 'infinity';
  1599.                         else if (value == 0 && difference < 0)
  1600.                             diff = '-100%';
  1601.                         else {
  1602.                             var upDown = (difference / ((value - difference) / 100));
  1603.                             if (upDown < 1 && upDown > -1)
  1604.                                 diff = upDown.toFixed(2) + '%';
  1605.                             else if (upDown < 1000 && upDown > -1000)
  1606.                                 diff = upDown.toFixed(1) + '%';
  1607.                             else {
  1608.                                 if (upDown < 0) {
  1609.                                     if (typeof clipped != "undefined") {
  1610.                                         diff = '-' + this.roundNumRankNew((-1 * upDown.toFixed(0))) + '%';
  1611.                                     } else {
  1612.                                         diff = '-' + this.breakToThreeSpace((-1 * upDown.toFixed(0))) + '%';
  1613.                                     }
  1614.                                 } else {
  1615.                                     if (typeof clipped != "undefined") {
  1616.                                         diff = this.roundNumRankNew(upDown.toFixed(0)) + '%';
  1617.                                     } else {
  1618.                                         diff = this.breakToThreeSpace(upDown.toFixed(0)) + '%';
  1619.                                     }
  1620.                                 }
  1621.                             }
  1622.                         }
  1623.                         if (typeof sorted != "undefined" && sorted) {
  1624.                             classes += ' class="sem-widget-sorted-td"';
  1625.                         }
  1626.                         ret += '<td align="right" ' + classes + ' title="' + diff + '" style="padding-right:2px;';
  1627.                         if (difference < 0) {
  1628.                             if (typeof clipped != "undefined") {
  1629.                                 ret += 'color:#c00;">' + '-' + this.roundNumRankNew((-1 * difference));
  1630.                             } else {
  1631.                                 ret += 'color:#c00;">' + '-' + this.breakToThreeComa((-1 * difference));
  1632.                             }
  1633.                         } else if (difference > 0) {
  1634.                             if (typeof clipped != "undefined") {
  1635.                                 ret += 'color:#090;">' + this.roundNumRankNew(difference);
  1636.                             } else {
  1637.                                 ret += 'color:#090;">' + this.breakToThreeComa(difference);
  1638.                             }
  1639.                         } else {
  1640.                             ret += '">' + difference;
  1641.                         }
  1642.                         ret += '</td>';
  1643.                         return ret;
  1644.                     },
  1645.                     strClipOld: function(i, l, t, h, w) {
  1646.                         if (i == null || i == undefined)
  1647.                             return '';
  1648.                         var s = new String("");
  1649.                         s += i;
  1650.                         if (h)
  1651.                             s = s.replace(/^http[s]?:\/\//ig, '');
  1652.                         if (w)
  1653.                             s = s.replace(/^www\./ig, '');
  1654.                         if (l >= s.length)
  1655.                             return s;
  1656.                         if (t == 'right')
  1657.                             return s.substring(0, l) + '...';
  1658.                         if (t == 'center') {
  1659.                             var r = Math.floor(l / 2);
  1660.                             return s.substring(0, r) + '...' + s.substring(s.length - r, s.length);
  1661.                         }
  1662.                         return s;
  1663.                     },
  1664.                     makeBigTrend: function(trend, no_trend_data) {
  1665.                         if (trend.length == 0)
  1666.                             return '<div style="width: 100%; text-align: center; height: 55px;">' + no_trend_data + '</div>';
  1667.                         else {
  1668.                             var trend_array = trend.split(",");
  1669.                             var trind_str = new String('<table cellspacing=0 cellpadding=0 width=100% height=60px><tr>');
  1670.                             $.each(trend_array, function(j, trend_block) {
  1671.                                 var block_height = trend_block * 60;
  1672.                                 trind_str += '<td valign="bottom" style="border: 0px; margin: 0px; padding: 0px 4px;background-color:#fff; box-shadow:none;">';
  1673.                                 trind_str += '<div style="height: ' + block_height + 'px;" class="big-trend-bg">&nbsp;</div>';
  1674.                                 trind_str += '</td>';
  1675.                             });
  1676.                             return trind_str += '</tr></table>';
  1677.                         }
  1678.                     },
  1679.                     displayCountryFlag: function(country) {
  1680.                         var title = (typeof geoCountries[country] != 'undefined') ? geoCountries[country] : country
  1681.                           , ret = '<i title="' + title + '" class="js-copy-class sem-' + country.toLowerCase() + '">' + country.toUpperCase() + '</i>';
  1682.                         return ret;
  1683.                     },
  1684.                     displayDatabaseFlag: function(db) {
  1685.                         db = _.replace(db, /(bing-|mobile-|-ext)/, '');
  1686.                         return "<i class='sem-" + db + "'></i>";
  1687.                     },
  1688.                     displayRefDomainLink: function(member) {
  1689.                         if (!member || member.length === 0) {
  1690.                             var link = jQuery('<a/>').attr('href', app.conf.DB_PREFIX + '/limit_results/').css('padding-left', '0').text(app.conf.R_UPLIM);
  1691.                             return jQuery("<td/>").append(link).html();
  1692.                         }
  1693.                         var cnt = jQuery("<nobr/>")
  1694.                           , dLink = jQuery("<a/>", {
  1695.                             'class': 'sem-widget-url-img',
  1696.                             'title': 'http://' + member,
  1697.                             'target': '_blank',
  1698.                             'href': 'http://' + member
  1699.                         }).appendTo(cnt)
  1700.                           , iLink = jQuery("<a/>", {
  1701.                             'href': app.conf.DB_PREFIX + app.conf.DB_DATE_PREFIX + '/info/' + member
  1702.                         }).text(member).appendTo(cnt);
  1703.                         return cnt.html()
  1704.                     },
  1705.                     displayRefIP: function(ipAddr) {
  1706.                         if (!ipAddr || ipAddr.length === 0) {
  1707.                             var link = jQuery('<a/>').attr('href', app.conf.DB_PREFIX + '/limit_results/').css('padding-left', '0').text(app.conf.R_UPLIM);
  1708.                             return jQuery("<td/>").append(link).html();
  1709.                         }
  1710.                         return ipAddr;
  1711.                     },
  1712.                     displayTLD: function(zone) {
  1713.                         if (!zone || zone.length === 0) {
  1714.                             var link = jQuery('<a/>').attr('href', app.conf.DB_PREFIX + '/limit_results/').css('padding-left', '0').text(app.conf.R_UPLIM);
  1715.                             return jQuery("<td/>").append(link).html();
  1716.                         }
  1717.                         return '.' + zone;
  1718.                     },
  1719.                     displayCountry: function(country) {
  1720.                         if (!country || country.length === 0) {
  1721.                             var link = jQuery('<a/>').attr('href', app.conf.DB_PREFIX + '/limit_results/').css('padding-left', '0').text(app.conf.R_UPLIM);
  1722.                             return jQuery("<td/>").append(link).html();
  1723.                         }
  1724.                         return geoCountries[country] ? geoCountries[country] : country;
  1725.                     },
  1726.                     crossLinkToFilteredReport: function(reportItem, displayItem, destination, filterType, reportTarget, reportTargetType) {
  1727.                         if (!reportItem || reportItem.length === 0) {
  1728.                             return this.breakToThreeComa(displayItem);
  1729.                         }
  1730.                         if (reportItem == '<EmptyAnchor>')
  1731.                             reportItem = '';
  1732.                         var sign = (filterType == 'anchor' || filterType == 'refdomain' || filterType == 'ip') ? 'Eq' : '';
  1733.                         var href = app.conf.DB_PREFIX + app.conf.DB_DATE_PREFIX + '/info/' + reportTarget + '+(' + destination + ')?target_type=' + reportTargetType + '&filter=%2B%7C' + filterType + '%7C' + sign + '%7C' + encodeURIComponent(reportItem);
  1734.                         link = $('<a/>').attr('href', href).text(this.breakToThreeComa(displayItem));
  1735.                         return $('<td/>').append(link).html();
  1736.                     },
  1737.                     displayBacklinkLink: function(member) {
  1738.                         var td = $('<td>').addClass('table-first-cell'), c = $('<div>'), t = $('<div>'), u = $('<div>').addClass('backlinks-divlinks'), a = $('<a>'), tl = $('<div>').addClass('backlinks-divlinks'), tla = $('<a>'), stu = $('<span>').addClass('backlinks-tslink-span').text('Target URL: '), ssu = $('<span>').addClass('backlinks-tslink-span').text('Source URL: '), trimmedURL = member.source_url, trimmedTitle;
  1739.                         if (member.source_url.length == 0) {
  1740.                             a.attr('href', app.conf.DB_PREFIX + '/limit_results/').css('padding-left', '0').text(app.conf.R_UPLIM);
  1741.                         } else if (member.source_url.length > 60) {
  1742.                             trimmedURL = this.strClipOld(member.source_url, 60, 'right', false, false);
  1743.                             u.attr('title', member.source_url);
  1744.                             u.append(ssu);
  1745.                             if (member.source_url.substring(0, 7) != 'http://' && member.source_url.substring(0, 8) != 'https://') {
  1746.                                 a.attr('href', 'http://' + member.source_url).text(trimmedURL);
  1747.                             } else {
  1748.                                 a.attr('href', member.source_url).text(trimmedURL);
  1749.                             }
  1750.                         } else {
  1751.                             u.append(ssu);
  1752.                             if (member.source_url.substring(0, 7) != 'http://' && member.source_url.substring(0, 8) != 'https://') {
  1753.                                 a.attr('href', 'http://' + member.source_url).text(trimmedURL);
  1754.                             } else {
  1755.                                 a.attr('href', member.source_url).text(trimmedURL);
  1756.                             }
  1757.                         }
  1758.                         if (member.source_title != undefined && member.source_title.length > 0) {
  1759.                             if (member.source_title.length > 150) {
  1760.                                 trimmedTitle = this.strClipOld(member.source_title, 150, 'right', false, false);
  1761.                                 t.attr('title', member.source_title);
  1762.                             } else {
  1763.                                 trimmedTitle = member.source_title;
  1764.                             }
  1765.                             t.text(trimmedTitle);
  1766.                             t.addClass('backlinks-titles');
  1767.                             c.append(t);
  1768.                         }
  1769.                         u.append(a);
  1770.                         c.append(u);
  1771.                         if (member.source_url.length > 0 && member.target_url != undefined && member.target_url.length > 0) {
  1772.                             var clluuu;
  1773.                             if (member.target_url.length > 60) {
  1774.                                 clluuu = this.strClipOld(member.target_url, 60, 'right', false, false);
  1775.                                 tla.attr('title', member.target_url);
  1776.                                 tl.append(stu);
  1777.                                 if (member.target_url.substring(0, 7) != 'http://' && member.target_url.substring(0, 8) != 'https://') {
  1778.                                     tla.attr('href', 'http://' + member.target_url).text(clluuu);
  1779.                                 } else {
  1780.                                     tla.attr('href', member.target_url).text(clluuu);
  1781.                                 }
  1782.                             } else {
  1783.                                 clluuu = member.target_url;
  1784.                                 tl.append(stu);
  1785.                                 if (member.target_url.substring(0, 7) != 'http://' && member.target_url.substring(0, 8) != 'https://') {
  1786.                                     tla.attr('href', 'http://' + member.target_url).text(clluuu);
  1787.                                 } else {
  1788.                                     tla.attr('href', member.target_url).text(clluuu);
  1789.                                 }
  1790.                             }
  1791.                             tl.append(tla);
  1792.                             c.append(tl);
  1793.                         }
  1794.                         td.append(c);
  1795.                         return '<td style="text-align:left;">' + td.html() + '</td>';
  1796.                     },
  1797.                     displayBacklinkLinkSource: function(member) {
  1798.                         var td = $('<td>').addClass('table-first-cell'), content = $('<div>'), title = $('<div>'), bl_div = $('<div>').addClass('backlinks-divlinks'), anchor = $('<a>'), trimmedURL = member.source_url, trimmedTitle;
  1799.                         if (member.source_url.length == 0) {
  1800.                             anchor.attr('href', app.conf.DB_PREFIX + '/limit_results/').css('padding-left', '0').text(app.conf.R_UPLIM);
  1801.                         } else {
  1802.                             if (member.source_url.length > 45) {
  1803.                                 trimmedURL = this.strClipOld(member.source_url, 45, 'right', false, false);
  1804.                                 bl_div.attr('title', member.source_url);
  1805.                             }
  1806.                             if (member.source_url.substring(0, 7) != 'http://') {
  1807.                                 anchor.attr('href', 'http://' + member.source_url).text(trimmedURL);
  1808.                             } else {
  1809.                                 anchor.attr('href', member.source_url).text(trimmedURL);
  1810.                             }
  1811.                         }
  1812.                         if (member.source_title != undefined && member.source_title.length > 0) {
  1813.                             if (member.source_title.length > 50) {
  1814.                                 trimmedTitle = this.strClipOld(member.source_title, 50, 'right', false, false);
  1815.                                 title.attr('title', member.source_title);
  1816.                             } else {
  1817.                                 trimmedTitle = member.source_title;
  1818.                             }
  1819.                             title.text(trimmedTitle);
  1820.                             title.addClass('backlinks-titles');
  1821.                             content.append(title);
  1822.                         }
  1823.                         bl_div.append(anchor);
  1824.                         content.append(bl_div);
  1825.                         td.append(content);
  1826.                         return '<td style="text-align:left;">' + td.html() + '</td>';
  1827.                     },
  1828.                     displayBacklinksPagesLink: function(member) {
  1829.                         var td = $('<td>').addClass('table-first-cell'), c = $('<div>'), t = $('<div>'), u = $('<div>').addClass('backlinks-divlinks'), a = $('<a>'), ssu = $('<span>').addClass('backlinks-tslink-span'), trimmedURL = member.source_url, trimmedTitle;
  1830.                         if (member.source_url.length == 0) {
  1831.                             a.attr('href', app.conf.DB_PREFIX + '/limit_results/').css('padding-left', '0').text(app.conf.R_UPLIM);
  1832.                         } else if (member.source_url.length > 60) {
  1833.                             trimmedURL = this.strClipOld(member.source_url, 60, 'right', false, false);
  1834.                             u.attr('title', member.source_url);
  1835.                             u.append(ssu);
  1836.                             if (member.source_url.substring(0, 4) != 'http') {
  1837.                                 a.attr('href', 'http://' + member.source_url).text(trimmedURL);
  1838.                             } else {
  1839.                                 a.attr('href', member.source_url).text(trimmedURL);
  1840.                             }
  1841.                         } else {
  1842.                             u.append(ssu);
  1843.                             if (member.source_url.substring(0, 4) != 'http') {
  1844.                                 a.attr('href', 'http://' + member.source_url).text(trimmedURL);
  1845.                             } else {
  1846.                                 a.attr('href', member.source_url).text(trimmedURL);
  1847.                             }
  1848.                         }
  1849.                         if (member.source_title != undefined && member.source_title.length > 0) {
  1850.                             if (member.source_title.length > 150) {
  1851.                                 trimmedTitle = this.strClipOld(member.source_title, 150, 'right', false, false);
  1852.                                 t.attr('title', member.source_title);
  1853.                             } else {
  1854.                                 trimmedTitle = member.source_title;
  1855.                             }
  1856.                             t.text(trimmedTitle);
  1857.                             t.addClass('backlinks-titles');
  1858.                             c.append(t);
  1859.                         }
  1860.                         u.append(a);
  1861.                         c.append(u);
  1862.                         td.append(c);
  1863.                         return '<td style="text-align:left;">' + td.html() + '</td>';
  1864.                     },
  1865.                     displayBacklinkAnchor: function(member) {
  1866.                         var td = $('<td>').attr('align', 'left');
  1867.                         var anchorTxt = member.anchor;
  1868.                         if (anchorTxt.length > 0) {
  1869.                             if (anchorTxt.length > 40) {
  1870.                                 anchorTxt = this.strClipOld(anchorTxt, 40, 'right', false, false);
  1871.                             }
  1872.                             var div = $('<div>').text(anchorTxt);
  1873.                             td.append(div).addClass('backlinks-anchors');
  1874.                         } else {
  1875.                             td.html('&nbsp;');
  1876.                         }
  1877.                         return '<td style="text-align:left;">' + td.html() + '</td>';
  1878.                     },
  1879.                     displayBacklinkAnchorTarget: function(member) {
  1880.                         var td = $('<td>').attr('align', 'left')
  1881.                           , content = $('<div>')
  1882.                           , bl_div = $('<div>').addClass('backlinks-divlinks')
  1883.                           , anchor = $('<a>');
  1884.                         var anchorTxt = member.anchor;
  1885.                         if (anchorTxt.length > 0) {
  1886.                             if (anchorTxt.length > 40) {
  1887.                                 anchorTxt = this.strClipOld(anchorTxt, 40, 'right', false, false);
  1888.                             }
  1889.                             var div = $('<div>').text(anchorTxt);
  1890.                             td.append(div).addClass('backlinks-anchors');
  1891.                         } else {
  1892.                             td.html('&nbsp;');
  1893.                         }
  1894.                         if (member.source_url.length > 0 && member.target_url != undefined && member.target_url.length > 0) {
  1895.                             var clluuu;
  1896.                             if (member.target_url.length > 45) {
  1897.                                 clluuu = this.strClipOld(member.target_url, 45, 'right', false, false);
  1898.                                 anchor.attr('title', member.target_url);
  1899.                                 if (member.target_url.substring(0, 7) != 'http://') {
  1900.                                     anchor.attr('href', 'http://' + member.target_url).text(clluuu);
  1901.                                 } else {
  1902.                                     anchor.attr('href', member.target_url).text(clluuu);
  1903.                                 }
  1904.                             } else {
  1905.                                 clluuu = member.target_url;
  1906.                                 if (member.target_url.substring(0, 7) != 'http://') {
  1907.                                     anchor.attr('href', 'http://' + member.target_url).text(clluuu);
  1908.                                 } else {
  1909.                                     anchor.attr('href', member.target_url).text(clluuu);
  1910.                                 }
  1911.                             }
  1912.                             bl_div.append(anchor);
  1913.                             content.append(bl_div);
  1914.                             td.append(content);
  1915.                         }
  1916.                         return '<td style="text-align:left;">' + td.html() + '</td>';
  1917.                     },
  1918.                     displayFormattedAnchor: function(member) {
  1919.                         if (member == '<EmptyAnchor>') {
  1920.                             return '<i style="color:#999">Empty Anchor</i>';
  1921.                         }
  1922.                         return _.escape(member);
  1923.                     },
  1924.                     displayBacklinkRank: function(member) {
  1925.                         var td = $('<td>').attr('align', 'left');
  1926.                         if (member.rank || member.rank === 0) {
  1927.                             var div = $('<div>').text(member.rank);
  1928.                             td.append(div).addClass('backlinks-anchors');
  1929.                         } else {
  1930.                             td.html('&nbsp;');
  1931.                         }
  1932.                         return '<td style="text-align:left;">' + td.html() + '</td>';
  1933.                     },
  1934.                     displayBacklinkExternalLinks: function(member) {
  1935.                         var td = $('<td>').attr('align', 'right');
  1936.                         if (member.external_link_num || member.external_link_num === 0) {
  1937.                             var div = $('<div>').text(member.external_link_num);
  1938.                             td.append(div).addClass('backlinks-anchors');
  1939.                         } else {
  1940.                             td.html('&nbsp;');
  1941.                         }
  1942.                         return '<td style="text-align:right;">' + td.html() + '</td>';
  1943.                     },
  1944.                     displayBacklinkInternalLinks: function(member) {
  1945.                         var td = $('<td>').attr('align', 'right');
  1946.                         if (member.internal_link_num || member.internal_link_num === 0) {
  1947.                             var div = $('<div>').text(member.internal_link_num);
  1948.                             td.append(div).addClass('backlinks-anchors');
  1949.                         } else {
  1950.                             td.html('&nbsp;');
  1951.                         }
  1952.                         return '<td style="text-align:right;">' + td.html() + '</td>';
  1953.                     },
  1954.                     displayBacklinkLastSeenDate: function(member) {
  1955.                         var td = $('<td>');
  1956.                         if (member.last_seen != undefined && member.last_seen > 0) {
  1957.                             var date = new Date(member.last_seen * 1000);
  1958.                             var month = months[date.getMonth()]
  1959.                               , year = date.getFullYear()
  1960.                               , day = date.getDate();
  1961.                             td.html(day + ' ' + month + ' ' + year);
  1962.                             td.addClass('backlinks-date');
  1963.                         } else {
  1964.                             td.html('&nbsp;');
  1965.                         }
  1966.                         return td.html();
  1967.                     },
  1968.                     displayBacklinkFirstSeenDate: function(member) {
  1969.                         var td = $('<td>');
  1970.                         if (member.first_seen != undefined && member.first_seen > 0) {
  1971.                             var date = new Date(member.first_seen * 1000);
  1972.                             var month = months[date.getMonth()]
  1973.                               , year = date.getFullYear()
  1974.                               , day = date.getDate();
  1975.                             td.html(day + ' ' + month + ' ' + year);
  1976.                             td.addClass('backlinks-date');
  1977.                         } else {
  1978.                             td.html('&nbsp;');
  1979.                         }
  1980.                         return td.html();
  1981.                     },
  1982.                     displayBacklinkType: function(member) {
  1983.                         var td = $('<td>');
  1984.                         if (!member.nofollow && !member.frame && !member.form && !member.image && !member.sitewide) {
  1985.                             return '<td style="text-align:center;">&nbsp;</td>';
  1986.                         }
  1987.                         if (member.nofollow) {
  1988.                             var div = $('<div/>').addClass("sem-backlinks-type bl-nofollow");
  1989.                             td.append(div)
  1990.                         }
  1991.                         if (member.frame) {
  1992.                             var div = $('<div/>').addClass("sem-backlinks-type bl-frame");
  1993.                             td.append(div)
  1994.                         }
  1995.                         if (member.form) {
  1996.                             var div = $('<div/>').addClass("sem-backlinks-type bl-form");
  1997.                             td.append(div)
  1998.                         }
  1999.                         if (member.image) {
  2000.                             var div = $('<div/>').addClass("sem-backlinks-type bl-image");
  2001.                             td.append(div)
  2002.                         }
  2003.                         if (member.sitewide) {
  2004.                             var div = $('<div/>').addClass("sem-backlinks-type bl-sitewide");
  2005.                             td.append(div)
  2006.                         }
  2007.                         return '<td style="text-align:center;">' + td.html() + '</td>';
  2008.                     },
  2009.                     displayBacklinksComparisonValueLink: function(currentProperty, propsArray, href) {
  2010.                         if (typeof currentProperty === 'undefined')
  2011.                             currentProperty = 0;
  2012.                         var parsed = parseInt(currentProperty)
  2013.                         var parsedMax = parseInt(Math.max.apply(Math, propsArray))
  2014.                         var parsedMin = parseInt(Math.min.apply(Math, propsArray))
  2015.                         if (parsed == 0)
  2016.                             return this.roundNumRankNew(parsed)
  2017.                         if (parsedMax == parsed)
  2018.                             return '<a style="color:#009900" href="' + href + '"><span>' + this.roundNumRankNew(parsed) + '</span></a>'
  2019.                         if (parsedMin == parsed)
  2020.                             return '<a style="color:red" href="' + href + '"><span>' + this.roundNumRankNew(parsed) + '</span></a>'
  2021.                         return '<a href="' + href + '">' + this.roundNumRankNew(parsed) + '</a>';
  2022.                     },
  2023.                     dispAdCopy: function(url, txt, desc, v_url, kw) {
  2024.                         var td = $('<td>').attr('align', 'center').addClass('table-first-cell').addClass('ads-wr-open');
  2025.                         var img_w = $('<div>').addClass('sem-widget-ad-icon');
  2026.                         if (kw.length > 0) {
  2027.                             txt = txt.replace(/<\/a>.+/i, "");
  2028.                             desc = desc.replace(/<span[^>]*>(.+)?<\/span>/ig, "");
  2029.                             desc = desc.replace(/<a[^>]*>(.+)?<\/a>/ig, "");
  2030.                             if (desc.match(/<table[^>]*>/ig) && !desc.match(/<\/table>/ig))
  2031.                                 desc = '';
  2032.                             desc = desc.replace(/<table[^>]*>(.+)?<\/table>/ig, "");
  2033.                             desc = desc.replace(/&nbsp;$/ig, "");
  2034.                             desc = desc.replace(/<br>$/ig, "");
  2035.                             img_w.addClass('sem-widget-ad-icon-active');
  2036.                             var div = $('<div>').addClass('sem-widget-ad-view');
  2037.                             var divStyle = $('<div>').addClass('sem-widget-ad-view-style');
  2038.                             var divttl = $('<a>').addClass('ads-ln').attr({
  2039.                                 'href': url,
  2040.                                 'target': '_blank'
  2041.                             }).html(txt);
  2042.                             var divd = $('<div>').addClass('ads-d').html(desc);
  2043.                             var cite = $('<cite>').addClass('ads-cite').html(v_url);
  2044.                             div.append(divStyle);
  2045.                             divStyle.append(divttl);
  2046.                             divStyle.append(divd);
  2047.                             divStyle.append(cite);
  2048.                             img_w.append(div);
  2049.                             td.append(img_w);
  2050.                         } else {
  2051.                             img_w.addClass('sem-widget-ad-icon-passive');
  2052.                             td.append(img_w);
  2053.                         }
  2054.                         return '<td align="center" style="text-align:center;" class="table-first-cell ads-wr-open">' + td.html() + '</td>';
  2055.                     },
  2056.                     dispAdCopy1: function(url, txt, desc, v_url, kw) {
  2057.                         var td = $('<td>').attr('align', 'center').addClass('table-first-cell').addClass('ads-wr-open');
  2058.                         var img_w = $('<div>').addClass('sem-widget-ad-icon');
  2059.                         if (kw.length > 0) {
  2060.                             txt = txt.replace(/<\/a>.+/i, "");
  2061.                             desc = desc.replace(/<span[^>]*>(.+)?<\/span>/ig, "");
  2062.                             desc = desc.replace(/<a[^>]*>(.+)?<\/a>/ig, "");
  2063.                             if (desc.match(/<table[^>]*>/ig) && !desc.match(/<\/table>/ig))
  2064.                                 desc = '';
  2065.                             desc = desc.replace(/<table[^>]*>(.+)?<\/table>/ig, "");
  2066.                             desc = desc.replace(/&nbsp;$/ig, "");
  2067.                             desc = desc.replace(/<br>$/ig, "");
  2068.                             img_w.addClass('sem-widget-ad-icon-active');
  2069.                             var div = $('<div>').addClass('sem-widget-ad-view');
  2070.                             var divStyle = $('<div>').addClass('sem-widget-ad-view-style');
  2071.                             var divttl = $('<a>').addClass('ads-ln').attr({
  2072.                                 'href': url,
  2073.                                 'target': '_blank'
  2074.                             }).html(txt);
  2075.                             var span = $('<span>').addClass('sem-report-block-ad').html("Ad");
  2076.                             var cite = $('<div>').addClass('sem-widget-type-ads-domain').append(span).append(v_url);
  2077.                             var divd = $('<div>').addClass('ads-d').html(desc);
  2078.                             div.append(divStyle);
  2079.                             divStyle.append(divttl);
  2080.                             divStyle.append(cite);
  2081.                             divStyle.append(divd);
  2082.                             img_w.append(div);
  2083.                             td.append(img_w);
  2084.                         } else {
  2085.                             img_w.addClass('sem-widget-ad-icon-passive');
  2086.                             td.append(img_w);
  2087.                         }
  2088.                         return '<td align="center" style="text-align:center;" class="table-first-cell ads-wr-open">' + td.html() + '</td>';
  2089.                     },
  2090.                     dispDomAds: function(domain, adsense, donotcutdomain) {
  2091.                         var isIP = false;
  2092.                         if (domain instanceof Array) {
  2093.                             isIP = domain[0] ? false : true;
  2094.                             domain = domain[0] || this.parseDomainFromURL(domain[1]);
  2095.                         }
  2096.                         var isSetDomain = (domain.length > 0)
  2097.                           , ret = '';
  2098.                         if (isSetDomain) {
  2099.                             if (typeof donotcutdomain == "undefined" || donotcutdomain == false) {
  2100.                                 ret += '<nobr>';
  2101.                             }
  2102.                             if (typeof donotcutdomain == "undefined" || donotcutdomain == false) {
  2103.                                 ret += this.clipString4(domain, 25);
  2104.                             } else {
  2105.                                 ret += domain;
  2106.                             }
  2107.                             if (typeof donotcutdomain == "undefined" || donotcutdomain == false) {
  2108.                                 ret += '</nobr>';
  2109.                             }
  2110.                         }
  2111.                         return ret;
  2112.                     },
  2113.                     dispShoppingAd: function(url, title, price, shop_name, img, kw) {
  2114.                         var td = $('<td>').attr('align', 'center').addClass('table-first-cell').addClass('ads-wr-open');
  2115.                         var img_w = $('<div>').addClass('sem-widget-ad-icon');
  2116.                         if (kw.length > 0) {
  2117.                             title = title.replace(/<\/a>.+/i, "");
  2118.                             img_w.addClass('sem-widget-ad-icon-active');
  2119.                             var div = $('<div>').addClass('sem-widget-ad-view');
  2120.                             div.append($('<div>').addClass('sem-widget-ad-view-style').html(this.dispShoppingAdBody(url, title, price, shop_name, img)));
  2121.                             img_w.append(div);
  2122.                             td.append(img_w);
  2123.                         } else {
  2124.                             img_w.addClass('sem-widget-ad-icon-passive');
  2125.                             td.append(img_w);
  2126.                         }
  2127.                         return '<td align="center" style="text-align:center;" class="table-first-cell ads-wr-open">' + td.html() + '</td>';
  2128.                     },
  2129.                     dispShoppingAdBody: function(url, title, price, shop_name, img) {
  2130.                         price = price.replace(';"', '');
  2131.                         var divStyle = $('<div>').addClass('sem-widget-ad-view-style')
  2132.                           , divttl = $('<div>').addClass('sem-widget-ad-view-title').append($('<a>').addClass('product-title').attr({
  2133.                             'href': url,
  2134.                             'target': '_blank'
  2135.                         }).html(title))
  2136.                           , image = $('<div>').addClass('sem-widget-ad-view-img').append($('<a>').attr({
  2137.                             'href': url,
  2138.                             'target': '_blank'
  2139.                         }).append($('<img alt="" />').attr('src', img).attr('onerror', this.imageError)))
  2140.                           , cite = $('<div>').addClass('sem-widget-type-ads-shop').append(shop_name)
  2141.                           , divd = $('<div>').addClass('ads-d').html(price);
  2142.                         var divv = $('<div>').addClass('sem-widget-ad-view-txt').append(divttl).append(divd).append(cite);
  2143.                         var block = $('<div>').addClass('sem-widget-ad-view-blk').append(image).append(divv);
  2144.                         divStyle.append(block);
  2145.                         return divStyle.html();
  2146.                     },
  2147.                     dispShoppingAdBodyOverview: function(domain, title, price, shop_name, img) {
  2148.                         var divStyle = $('<div>').addClass('sem-widget-ad-view-style')
  2149.                           , divttl = $('<div>').addClass('sem-widget-ad-view-title').append($('<p>').addClass('product-title').html(title))
  2150.                           , image = $('<div>').addClass('sem-widget-ad-view-img').append($('<p>').append($('<img alt="" />').attr('src', img).attr('onerror', this.imageError)))
  2151.                           , cite = $('<div>').addClass('sem-widget-type-ads-shop').append(shop_name)
  2152.                           , divd = (price) ? $('<div>').addClass('ads-d').html(price) : '';
  2153.                         var divv = $('<div>').addClass('sem-widget-ad-view-txt').append(divttl).append(divd).append(cite);
  2154.                         var block = $('<div>').addClass('sem-widget-ad-view-blk').append(image).append(divv);
  2155.                         var isIP = false;
  2156.                         if (domain instanceof Array) {
  2157.                             isIP = domain[0] ? false : true;
  2158.                             domain = domain[0] || this.parseDomainFromURL(domain[1]);
  2159.                         }
  2160.                         if (!isIP && domain) {
  2161.                             $(block).attr('domain', domain);
  2162.                         }
  2163.                         divStyle.append(block);
  2164.                         return divStyle.html();
  2165.                     },
  2166.                     displayLimits: function() {
  2167.                         var ret = '<a href="' + app.conf.DB_PREFIX + '/limit_results/"' + app.conf.ADD_REG_FORM + '>' + app.conf.R_UPLIM + '</a>';
  2168.                         return ret;
  2169.                     },
  2170.                     displayAdsCell: function(member) {
  2171.                         var td = $('<td>');
  2172.                         if (member.Ph != undefined && member.Ph.length > 0) {
  2173.                             td = $('<td>').css('vertical-align', 'top');
  2174.                             if (member.Ds.match(/<table[^>]*>/ig) && !member.Ds.match(/<\/table>/ig)) {
  2175.                                 member.Ds = '';
  2176.                                 member.Vu = member.Vu.replace(/&lt;\/?b&gt;/ig, "");
  2177.                                 member.Vu = member.Vu.replace(/&lt;wbr&gt;/ig, "");
  2178.                                 member.Vu = member.Vu.replace(/&amp;amp;/ig, "&");
  2179.                                 if (member.Vu.length > 40) {
  2180.                                     member.Vu = member.Vu.substring(0, 35) + '<br />' + member.Vu.substring(35);
  2181.                                 }
  2182.                             }
  2183.                             member.Ds = member.Ds.replace(/<table[^>]*>(.+)?<\/table>/ig, "");
  2184.                             member.Ds = member.Ds.replace(/<span[^>]*>(.+)?<\/span>/ig, "");
  2185.                             member.Ds = member.Ds.replace(/<a[^>]*>(.+)?<\/a>/ig, "");
  2186.                             member.Ds = member.Ds.replace(/&nbsp;$/ig, "");
  2187.                             member.Ds = member.Ds.replace(/<br>$/ig, "");
  2188.                             member.Tt = member.Tt.replace(/<\/a>.+/i, "");
  2189.                             td.html('<a href="' + member.Ur + '" target="_blank">' + member.Tt + '</a><div>' + member.Ds + '</div><div class="report_ads" title="' + member.Vu + '">' + member.Vu + '</span>');
  2190.                             return '<td>' + td.html() + '</td>';
  2191.                         } else {
  2192.                             var td = $('<td>').attr({
  2193.                                 'valign': 'middle',
  2194.                                 'align': 'center',
  2195.                                 'height': '72px'
  2196.                             });
  2197.                             td.html(this.displayLimits());
  2198.                             return '<td style="text-align:center!important;height:72px;vertical-align:middle;">' + td.html() + '</td>';
  2199.                         }
  2200.                     },
  2201.                     displayAdsBody: function(member) {
  2202.                         if (member.Ph != undefined && member.Ph.length > 0) {
  2203.                             if (member.Ds.match(/<table[^>]*>/ig) && !member.Ds.match(/<\/table>/ig)) {
  2204.                                 member.Ds = '';
  2205.                                 member.Vu = member.Vu.replace(/&lt;\/?b&gt;/ig, "");
  2206.                                 member.Vu = member.Vu.replace(/&lt;wbr&gt;/ig, "");
  2207.                                 member.Vu = member.Vu.replace(/&amp;amp;/ig, "&");
  2208.                                 if (member.Vu.length > 40) {
  2209.                                     member.Vu = member.Vu.substring(0, 35) + '<br />' + member.Vu.substring(35);
  2210.                                 }
  2211.                             }
  2212.                             member.Ds = member.Ds.replace(/<table[^>]*>(.+)?<\/table>/ig, "");
  2213.                             member.Ds = member.Ds.replace(/<span[^>]*>(.+)?<\/span>/ig, "");
  2214.                             member.Ds = member.Ds.replace(/<a[^>]*>(.+)?<\/a>/ig, "");
  2215.                             member.Ds = member.Ds.replace(/&nbsp;$/ig, "");
  2216.                             member.Ds = member.Ds.replace(/<br>$/ig, "");
  2217.                             member.Tt = member.Tt.replace(/<\/a>.+/i, "");
  2218.                             var html = '<a href="' + member.Ur + '" target="_blank">' + member.Tt + '</a><div>' + member.Ds + '</div>';
  2219.                             html += '<div class="report_ads" title="' + member.Vu + '">' + member.Vu + '</div>';
  2220.                             return html;
  2221.                         } else {
  2222.                             return '<div style="text-align:center!important;height:72px;vertical-align:middle;">' + this.displayLimits() + '</div>';
  2223.                         }
  2224.                     },
  2225.                     displayCategory: function(categories) {
  2226.                         if (typeof categories == "undefined")
  2227.                             return;
  2228.                         var html = ""
  2229.                           , catList = categories.split(', ');
  2230.                         html += "<ul style='text-align: left'>";
  2231.                         catList.forEach(function(item) {
  2232.                             html += "<li>" + item + "</li>";
  2233.                         });
  2234.                         html += "</ul>";
  2235.                         return html;
  2236.                     },
  2237.                     getIndexes: function(values) {
  2238.                         if (typeof values == "undefined" || !values.length)
  2239.                             return;
  2240.                         return _.map(values.split(','), function(value) {
  2241.                             return parseInt(value.trim());
  2242.                         });
  2243.                     },
  2244.                     adsTextmediaBar: function(width, domain1, domain2, by_type, total_ads, text_ads, media_ads, title_text_ads, title_media_ads) {
  2245.                         if (!total_ads) {
  2246.                             return '';
  2247.                         }
  2248.                         var txt = Math.round(text_ads / total_ads * 100);
  2249.                         var img = Math.round(media_ads / total_ads * 100);
  2250.                         var a_txt = '0'
  2251.                           , a_img = '0';
  2252.                         var link = (domain2 ? domain1 + ' ' + domain2 : domain1);
  2253.                         if (txt) {
  2254.                             a_txt = '/info/' + link + '+(' + by_type + ')?adstype=text_ads';
  2255.                             a_txt = '<a title="' + title_text_ads + '" href="' + a_txt + '" >' + txt + '%</a>';
  2256.                         }
  2257.                         if (img) {
  2258.                             a_img = '/info/' + link + '+(' + by_type + ')?adstype=media_ads';
  2259.                             a_img = '<a title="' + title_media_ads + '" href="' + a_img + '" >' + img + '%</a>';
  2260.                         }
  2261.                         return this.uilibDoublepercentLinkBar(width, img, a_txt, a_img);
  2262.                     },
  2263.                     uilibDoublepercentLinkBar: function(width, percents, text1, text2) {
  2264.                         var w50 = width / 2
  2265.                           , w48 = width / 2 - 2
  2266.                           , w49 = width / 2 - 1
  2267.                           , left = width * percents / 200;
  2268.                         return ['<div style="position: relative; font-size: 11px; display: inline-block; width: ' + width + 'px; height: 18px; text-align: center;">', '<div style="position: absolute; width: ' + w50 + 'px; height: 18px; background-color: #CDE5FF; left: ' + left + 'px;"></div>', '<div style="position: absolute; width: ' + w48 + 'px; height: 16px; border: solid 1px #99CAFF;">' + text1 + '</div>', '<div style="position: absolute; width: ' + w49 + 'px; height: 16px; border: solid 1px #99CAFF; right: 0;">' + text2 + '</div>', '</div>'].join('');
  2269.                     },
  2270.                     adsTextmediaBar1: function(width, domain1, domain2, by_type, total_ads, text_ads, media_ads, title_text_ads, title_media_ads) {
  2271.                         if (!total_ads) {
  2272.                             return '';
  2273.                         }
  2274.                         var txt = Math.round(text_ads / total_ads * 100);
  2275.                         var img = Math.round(media_ads / total_ads * 100);
  2276.                         var a_txt = '0'
  2277.                           , a_img = '0';
  2278.                         var link = (domain2 ? domain1 + ' ' + domain2 : domain1);
  2279.                         if (txt) {
  2280.                             a_txt = '/analytics/da/cross/' + domain1 + '?advertiserDomain=' + domain1 + '&publisherDomain=' + domain2 + '&detailedName=_textAds';
  2281.                             a_txt = '<a title="' + title_text_ads + '" href="' + a_txt + '" >' + txt + '%</a>';
  2282.                         }
  2283.                         if (img) {
  2284.                             a_img = '/analytics/da/cross/' + domain1 + '?advertiserDomain=' + domain1 + '&publisherDomain=' + domain2 + '&detailedName=mediaAds';
  2285.                             a_img = '<a title="' + title_media_ads + '" href="' + a_img + '" >' + img + '%</a>';
  2286.                         }
  2287.                         var left = width * img / 200;
  2288.                         return "<div class=\"sem-asns-text-media-container\">" + "<div class=\"sem-asns-text-media-fill\" style=\"left: " + left + "px;\"></div>" + "<div class=\"sem-asns-text-media-left\">" + a_txt + "</div>" + "<div class=\"sem-asns-text-media-right\">" + a_img + "</div>" + "<div class=\"sem-asns-text-media-separator\"></div>" + "</div>";
  2289.                         return this.uilibDoublepercentLinkBar1(width, img, a_txt, a_img);
  2290.                     },
  2291.                     uilibDoublepercentLinkBar1: function(width, percents, text1, text2) {
  2292.                         var w50 = width / 2
  2293.                           , w48 = width / 2 - 2
  2294.                           , w49 = width / 2 - 1
  2295.                           , left = width * percents / 200;
  2296.                         return ['<div style="position: relative; font-size: 11px; display: inline-block; width: ' + width + 'px; height: 18px; text-align: center; top: -9px;">', '<div style="position: absolute; width: ' + w50 + 'px; height: 18px; background-color: #CDE5FF; left: ' + left + 'px; padding: 9px 0;"></div>', '<div style="position: absolute; width: ' + w48 + 'px; height: 16px;">' + text1 + '</div>', '<div style="position: absolute; width: ' + w49 + 'px; height: 16px; right: 0;">' + text2 + '</div>', '</div>'].join('');
  2297.                     },
  2298.                     strToDate: function(i) {
  2299.                         return new Date(i.slice(0, 4),(parseInt(i.slice(4, 6), 10) - 1),i.slice(6));
  2300.                     },
  2301.                     getObjectLength: function(i) {
  2302.                         var l = 0, k;
  2303.                         for (k in i) {
  2304.                             if (i.hasOwnProperty(k))
  2305.                                 l++;
  2306.                         }
  2307.                         return l;
  2308.                     },
  2309.                     updatePositionCells: function(i, differenceFlag) {
  2310.                         var ret = i;
  2311.                         if (i.length != 0 && isNaN(parseInt(i, 10)))
  2312.                             return "<span class=\"sem-widget-tracking-na\">" + i + "</span>";
  2313.                         if (differenceFlag) {
  2314.                             ret = (parseInt(i, 10) > 0) ? "-" + i : "+" + Math.abs(i);
  2315.                         }
  2316.                         if (i.length == 0) {
  2317.                             return "<span class=\"sem-widget-empty-cell\">–</span>";
  2318.                         } else if (parseInt(i, 10) == 0) {
  2319.                             return "<span class=\"sem-widget-empty-cell\">0</span>";
  2320.                         }
  2321.                         if (differenceFlag) {
  2322.                             if (parseInt(i, 10) > 0) {
  2323.                                 return "<span class=\"sem-widget-down-cell\">" + ret + "</span>";
  2324.                             } else {
  2325.                                 return "<span class=\"sem-widget-up-cell\">" + ret + "</span>";
  2326.                             }
  2327.                         }
  2328.                         return "<span class=\"sem-widget-po-value\">" + ret + "</span>";
  2329.                     },
  2330.                     displDiffCell: function(i, signFlag) {
  2331.                         var ret;
  2332.                         if (signFlag) {
  2333.                             ret = (parseFloat(i, 10) > 0) ? "+" + i : "-" + Math.abs(i);
  2334.                         } else {
  2335.                             ret = Math.abs(i)
  2336.                         }
  2337.                         if (i.length == 0 || isNaN(parseFloat(i, 10)))
  2338.                             return "<span class=\"sem-widget-tracking-na\">-</span>";
  2339.                         if (parseFloat(i, 10) < 0) {
  2340.                             return "<span class=\"sem-widget-down-cell\">" + ret + "</span>";
  2341.                         } else if (parseFloat(i, 10) > 0) {
  2342.                             return "<span class=\"sem-widget-up-cell\">" + ret + "</span>";
  2343.                         } else {
  2344.                             return "<span class=\"sem-widget-empty-cell\">0</span>";
  2345.                         }
  2346.                     },
  2347.                     positionsDifference: function(i, diff) {
  2348.                         var out = '';
  2349.                         if (isNaN(parseInt(diff, 10)) || parseInt(diff, 10) == 0 || (i.length != 0 && isNaN(parseInt(i, 10)))) {
  2350.                             out = "<span class=\"sem-widget-diff\"></span>";
  2351.                             return out;
  2352.                         }
  2353.                         var ret = (parseInt(diff, 10) > 0) ? "-" + diff : "+" + Math.abs(diff);
  2354.                         if (parseInt(diff, 10) > 0) {
  2355.                             out = "<span class=\"sem-widget-diff sem-widget-diff-down\"><span>" + ret + "</span><i></i></span>";
  2356.                         } else {
  2357.                             out = "<span class=\"sem-widget-diff sem-widget-diff-up\"><span>" + ret + "</span><i></i></span>";
  2358.                         }
  2359.                         return out;
  2360.                     },
  2361.                     getSourceHref: function(positionIndex, keyword, campaign, date, searchEngine, domain, location, type, device_group, userKey) {
  2362.                         if (typeof type == "undefined") {
  2363.                             type = "organic";
  2364.                         }
  2365.                         domain = domain.replace(/^\*?\.?/g, '');
  2366.                         domain = domain.replace(/\/?\*?$/g, '');
  2367.                         if (positionIndex == "" || !isNaN(parseInt(positionIndex, 10)) && keyword && date) {
  2368.                             return '/info/' + keyword + '+(source)' + '?source_type=tracking' + '&campaign_id=' + campaign + '&date_begin=' + date + '&se=' + searchEngine + '&position=' + positionIndex + '&domain=' + domain + '&location=' + location + '&type=' + type + '&device_group=' + device_group + ((userKey) ? ('&key=' + userKey) : "");
  2369.                         } else {
  2370.                             return "";
  2371.                         }
  2372.                         return "";
  2373.                     },
  2374.                     displaySourceLink: function(positionIndex, keyword, date, type, device_group, domain, location, t, userKey, readOnly) {
  2375.                         type = t;
  2376.                         var ret = ""
  2377.                           , url = "";
  2378.                         url = this.getSourceHref(positionIndex, keyword, app.TrackingData.campaignId, date, app.TrackingData.seFullName, domain, location, type, device_group, ((url && readOnly) ? userKey : ""));
  2379.                         ret = '<a href="' + url + '" target="_blank" class="sem-widget-tracking-source-link" title="' + app.Messages.serp_source + '"></a>';
  2380.                         return ret;
  2381.                     },
  2382.                     mapColorClass: function(val) {
  2383.                         if (val > 75)
  2384.                             return "value-9";
  2385.                         if (val > 50)
  2386.                             return "value-8";
  2387.                         if (val > 40)
  2388.                             return "value-7";
  2389.                         if (val > 30)
  2390.                             return "value-6";
  2391.                         if (val > 25)
  2392.                             return "value-5";
  2393.                         if (val > 20)
  2394.                             return "value-4";
  2395.                         if (val > 15)
  2396.                             return "value-3";
  2397.                         if (val > 10)
  2398.                             return "value-2";
  2399.                         if (val > 1)
  2400.                             return "value-1";
  2401.                         if (val > 0)
  2402.                             return "value-0";
  2403.                         return "";
  2404.                     },
  2405.                     stringToArray: function(string) {
  2406.                         return JSON.parse("[" + string + "]")
  2407.                     },
  2408.                     escapeHtml: function(str) {
  2409.                         return str.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
  2410.                     },
  2411.                     removeSpecialChars: function(str) {
  2412.                         return str.replace(/&lt;/ig, "<").replace(/&gt;/ig, ">").replace(/&quot;/ig, '"').replace(/&#039;/g, "'").replace(/&amp;/ig, '&');
  2413.                     },
  2414.                     displayRounded: function(anyParam) {
  2415.                         var calcRoundArray = this.calcRound(anyParam);
  2416.                         return calcRoundArray[0] + calcRoundArray[1];
  2417.                     },
  2418.                     displaySimpleDate: function(date) {
  2419.                         if (!date) {
  2420.                             return '-';
  2421.                         }
  2422.                         date = parseInt(date, 10) / 1000;
  2423.                         Date.now = Date.now || function() {
  2424.                             return +new Date;
  2425.                         }
  2426.                         ;
  2427.                         var today = Math.round(Date.now() / 1000);
  2428.                         var difference = today - date;
  2429.                         if (difference < 0) {
  2430.                             return '-';
  2431.                         } else if (difference < 60) {
  2432.                             return difference + ' sec ago';
  2433.                         } else if (difference < 60 * 60) {
  2434.                             return Math.floor(difference / 60) + ' min ago';
  2435.                         } else if (difference < 24 * 60 * 60) {
  2436.                             return Math.floor(difference / 60 / 60) + ' hr ago';
  2437.                         } else if (difference < 7 * 24 * 60 * 60) {
  2438.                             difference = Math.floor(difference / 24 / 60 / 60);
  2439.                             return difference + ((difference == 1) ? ' day ago' : ' days ago');
  2440.                         } else {
  2441.                             date = new Date(date * 1000);
  2442.                             return date.getDate() + ' ' + app.conf.MONTH_SHORT_NAMES[date.getMonth()] + " " + date.getFullYear();
  2443.                         }
  2444.                     },
  2445.                     displaySimpleUTCDate: function(UTCString) {
  2446.                         return this.displaySimpleDate(new Date(UTCString).getTime());
  2447.                     },
  2448.                     displayPercents: function(piece, unit) {
  2449.                         var percent = (piece / unit) * 100;
  2450.                         return (percent > 1 ? percent.toFixed() : '1') + '%';
  2451.                     },
  2452.                     displayTimeInSeconds: function(t) {
  2453.                         ndate = new Date(1970,1,1,0,0,t);
  2454.                         return (ndate.getHours() > 0 ? this.prependZero(ndate.getHours()) + ":" : "") + this.prependZero(ndate.getMinutes()) + ":" + this.prependZero(ndate.getSeconds());
  2455.                     },
  2456.                     displayDiffDiv: function(value_diff, value, value_prev, date, date_prev, postfix, reverse) {
  2457.                         var sign = value_diff > 0 ? "+" : "", cssClass;
  2458.                         if (typeof postfix === 'undefined') {
  2459.                             postfix = '';
  2460.                         }
  2461.                         if (typeof reverse != 'undefined') {
  2462.                             cssClass = value_diff > 0 ? 'negative' : (value_diff == 0 ? "" : 'positive');
  2463.                         } else {
  2464.                             cssClass = value_diff > 0 ? 'positive' : (value_diff == 0 ? "" : 'negative');
  2465.                         }
  2466.                         var show_tooltip = false;
  2467.                         if (value != undefined) {
  2468.                             show_tooltip = true;
  2469.                         }
  2470.                         return '<div class="sem-report-header-td-diff ' + (show_tooltip ? 'sem-report-with-tooltip ' : '') + cssClass + '">' + sign + value_diff + '%' + (show_tooltip ? '<div class="sem-report-tooltip-down">' + this.displayDiffDivTooltip(value, value_prev, date, date_prev, postfix) + '</div>' : '') + '</div>'
  2471.                     },
  2472.                     displayDiffDivTooltip: function(value, prev_value, date, date_prev, postfix) {
  2473.                         var tooltip = 'Current value: ' + value + postfix + ' (' + date + ')<br />' + 'Previous value: ' + prev_value + postfix + (date_prev !== '' ? ' (' + date_prev + ')' : '');
  2474.                         return tooltip;
  2475.                     },
  2476.                     displayVideoLength: function(timestamp) {
  2477.                         var date, ret = "";
  2478.                         if (timestamp) {
  2479.                             date = new Date(parseInt(timestamp, 10) * 1000);
  2480.                             if (date.getUTCHours() > 0) {
  2481.                                 ret += date.getUTCHours() + ":"
  2482.                             }
  2483.                             ret += this.prependZero(date.getUTCMinutes()) + ":" + this.prependZero(date.getUTCSeconds()) + " ";
  2484.                         }
  2485.                         return ret;
  2486.                     },
  2487.                     truncateLongString: function(string) {
  2488.                         return truncateLongString(string, 64);
  2489.                     },
  2490.                     truncateLongString: function(str, limit) {
  2491.                         if (!str) {
  2492.                             return "";
  2493.                         }
  2494.                         return str.length > limit ? str.substr(0, limit - 1) + '&hellip;' : str;
  2495.                     },
  2496.                     formatCurrency: {
  2497.                         formatStringByCode: function(value, code) {
  2498.                             var currency = _.find(countriesCurrency, {
  2499.                                 code: code
  2500.                             });
  2501.                             return this.formatString(value, currency.db);
  2502.                         },
  2503.                         formatString: function(value, current_db) {
  2504.                             this.setFormat(current_db);
  2505.                             if (this.format) {
  2506.                                 var sign = '<span class="currency-sign">' + this.format.sign + '<div class="s-tooltip -topleft">' + this.format.code + '</div></span>';
  2507.                                 return this.position(value, sign);
  2508.                             } else {
  2509.                                 return value;
  2510.                             }
  2511.                         },
  2512.                         formatShSign: function(value, current_db) {
  2513.                             this.setFormat(current_db);
  2514.                             if (this.format) {
  2515.                                 var sign = this.getShSign();
  2516.                                 return this.position(value, sign);
  2517.                             } else {
  2518.                                 return value;
  2519.                             }
  2520.                         },
  2521.                         formatCode: function(current_db) {
  2522.                             this.setFormat(current_db);
  2523.                             if (this.format && this.format.hasOwnProperty('code')) {
  2524.                                 return '(' + this.format.code + ')';
  2525.                             }
  2526.                             return '';
  2527.                         },
  2528.                         setFormat: function(current_db) {
  2529.                             if (countriesCurrency.hasOwnProperty(current_db)) {
  2530.                                 this.format = countriesCurrency[current_db];
  2531.                             }
  2532.                         },
  2533.                         getShSign: function() {
  2534.                             return (this.format).hasOwnProperty('sh_sign') ? this.format.sh_sign : this.format.sign;
  2535.                         },
  2536.                         position: function(value, sign) {
  2537.                             if (this.format.hasOwnProperty('position') && this.format.position === 'r') {
  2538.                                 return value + '&nbsp;' + sign;
  2539.                             } else if (this.format.db === "ch") {
  2540.                                 return sign + "&nbsp;" + value;
  2541.                             }
  2542.                             return sign + value;
  2543.                         }
  2544.                     },
  2545.                     imageError: function() {
  2546.                         return 'this.onerror = null; this.src="' + app.conf.MEDIA_URL + '/img/image-not-found.png"';
  2547.                     },
  2548.                     muteCell: function(el, text) {
  2549.                         $(el).addClass('-cell-inactive').tipsy({
  2550.                             fallback: text,
  2551.                             gravity: "s"
  2552.                         });
  2553.                     },
  2554.                     addTooltipToMobileIcon: function(el) {
  2555.                         if (!$(el + " .js-icon-mobile__report").length)
  2556.                             return;
  2557.                         $(el + " .js-icon-mobile__report").each(function() {
  2558.                             $(this).tipsy({
  2559.                                 fallback: 'Mobile-friendly',
  2560.                                 gravity: "s"
  2561.                             });
  2562.                         });
  2563.                     },
  2564.                     getRestOfPercentage: function(data, col) {
  2565.                         var sum = _.reduce(_.pluck(_.take(data, col), 'percentage'), function(total, n) {
  2566.                             return total + n;
  2567.                         });
  2568.                         return sum < 100 ? Math.round((100 - sum) * 100) / 100 : 0;
  2569.                     },
  2570.                     dispBarLine: function(value) {
  2571.                         var html = '<div class="bar-line">';
  2572.                         html += '<div class="bar-line-inner" style="width: ' + value + '%;"></div>';
  2573.                         html += '</div>';
  2574.                         return html;
  2575.                     },
  2576.                     dispCheckFields: function(data, value) {
  2577.                         if (_.indexOf(data, value) < 0) {
  2578.                             return "";
  2579.                         }
  2580.                         return "<i class='s-icon -xs -check'></i>";
  2581.                     },
  2582.                     dispRoundedValue: function(value) {
  2583.                         return parseFloat(value).toFixed(2);
  2584.                     },
  2585.                     countFilteredTotal: function(data, page) {
  2586.                         var responce = data.responce;
  2587.                         if (data.length < 100) {
  2588.                             return (page - 1) * responce.get("limit") + data.length;
  2589.                         } else {
  2590.                             var parsed = parseInt(responce.get("parsed"), 10);
  2591.                             if (parsed > 0) {
  2592.                                 var received = parseInt(responce.get("offset", 10)) + data.length
  2593.                                   , total = parseInt(responce.get("total", 10));
  2594.                                 if (parsed < data.length) {
  2595.                                     parsed = received + 1;
  2596.                                 }
  2597.                                 return Math.ceil(received * total / parsed);
  2598.                             }
  2599.                         }
  2600.                     },
  2601.                     dispDescriptionField: function(desc) {
  2602.                         desc = desc.replace(/<span[^>]*>(.+)?<\/span>/ig, "");
  2603.                         desc = desc.replace(/<a[^>]*>(.+)?<\/a>/ig, "");
  2604.                         if (desc.match(/<table[^>]*>/ig) && !desc.match(/<\/table>/ig))
  2605.                             desc = '';
  2606.                         desc = desc.replace(/<table[^>]*>(.+)?<\/table>/ig, "");
  2607.                         desc = desc.replace(/&nbsp;$/ig, "");
  2608.                         desc = desc.replace(/<br>$/ig, "");
  2609.                         return desc;
  2610.                     },
  2611.                     dispTitleField: function(txt) {
  2612.                         return txt.replace(/<\/a>.+/i, "");
  2613.                     },
  2614.                     displayDatabaseTitle: function(db) {
  2615.                         var postfix = _.startsWith(db, 'bing') ? 'Bing' : (_.startsWith(db, 'mobile') ? 'Mobile' : 'Google');
  2616.                         return _.toUpper(_.replace(db, /^(bing-|mobile-)/, "")) + ' ' + postfix;
  2617.                     },
  2618.                     isMobileDb: function(db) {
  2619.                         return _.startsWith(db, 'mobile');
  2620.                     }
  2621.                 };
  2622.                 return app.helper;
  2623.             }
  2624.             )($, app);
  2625.         }
  2626.         .apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  2627.         __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  2628.     }
  2629.     , function(module, exports) {
  2630.         module.exports = __WEBPACK_EXTERNAL_MODULE_15__;
  2631.     }
  2632.     , function(module, exports) {
  2633.         module.exports = __WEBPACK_EXTERNAL_MODULE_16__;
  2634.     }
  2635.     , function(module, exports, __webpack_require__) {
  2636.         var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  2637.         !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(18)],
  2638.         __WEBPACK_AMD_DEFINE_RESULT__ = function($) {
  2639.             var cookiesUtils = {
  2640.                 getCookie: function(c_name) {
  2641.                     if (document.cookie.length > 0) {
  2642.                         var c_start = document.cookie.indexOf(c_name + "=");
  2643.                         if (c_start != -1) {
  2644.                             c_start = c_start + c_name.length + 1;
  2645.                             var c_end = document.cookie.indexOf(";", c_start);
  2646.                             if (c_end == -1)
  2647.                                 c_end = document.cookie.length;
  2648.                             return unescape(document.cookie.substring(c_start, c_end));
  2649.                         }
  2650.                         return "";
  2651.                     }
  2652.                     return "";
  2653.                 },
  2654.                 setCookie: function(c_name, value, expiredays, domain, path='/') {
  2655.                     var d;
  2656.                     if (domain != null) {
  2657.                         d = document.domain.replace(/^[a-z0-9]+\./i, '');
  2658.                     } else {
  2659.                         d = document.domain;
  2660.                     }
  2661.                     if (expiredays != null) {
  2662.                         var exdate = new Date();
  2663.                         exdate.setDate(exdate.getDate() + expiredays);
  2664.                         document.cookie = c_name + "=" + escape(value) + ";domain=" + d + ";path=" + path + ";" + ((expiredays == null) ? "" : "expires=" + exdate.toGMTString());
  2665.                     } else {
  2666.                         var futdate = new Date()
  2667.                         var expdate = futdate.getTime();
  2668.                         expdate += 3600 * 1000;
  2669.                         futdate.setTime(expdate);
  2670.                         document.cookie = c_name + "=" + escape(value) + ";domain=" + d + ";path=" + path + ";expires=" + futdate.toGMTString();
  2671.                     }
  2672.                 },
  2673.                 deleteCookie: function(name) {
  2674.                     var domain = document.domain.replace(/^[a-z0-9]+\./i, '');
  2675.                     var mainDomain = domain.replace('www.', '');
  2676.                     this.setCookie(name, 'delete', -300);
  2677.                     this.setCookie(name, 'delete', -300, '.' + domain);
  2678.                     this.setCookie(name, 'delete', -300, mainDomain);
  2679.                     this.setCookie(name, 'delete', -300, '.' + mainDomain);
  2680.                 }
  2681.             };
  2682.             return cookiesUtils;
  2683.         }
  2684.         .apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  2685.         __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  2686.     }
  2687.     , function(module, exports) {
  2688.         module.exports = __WEBPACK_EXTERNAL_MODULE_18__;
  2689.     }
  2690.     , function(module, exports) {
  2691.         module.exports = __WEBPACK_EXTERNAL_MODULE_19__;
  2692.     }
  2693.     , function(module, exports) {
  2694.         module.exports = __WEBPACK_EXTERNAL_MODULE_20__;
  2695.     }
  2696.     , function(module, exports, __webpack_require__) {
  2697.         var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  2698.         !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(22), __webpack_require__(23), __webpack_require__(16), __webpack_require__(4), __webpack_require__(17)],
  2699.         __WEBPACK_AMD_DEFINE_RESULT__ = function(_, CONTENT_TEMPLATE, CONTENT_TEMPLATE_NEW, countriesCurrency, Backbone, cookiesUtils) {
  2700.             "use strict";
  2701.             return Backbone.View.extend({
  2702.                 initialize: function(options, reportConfig) {
  2703.                     var CONF = this.CONF = options;
  2704.                     var defaultDb = 'us';
  2705.                     var defaultCurrency = this.getCurrencyInfo(defaultDb);
  2706.                     var currentDbCurrency = this.getCurrencyInfo(CONF.MIDDLE_WARE.current_db);
  2707.                     var currentCurrency = this.currentCurrency = CONF.MIDDLE_WARE.db_currency;
  2708.                     var currensyList = [];
  2709.                     if (currentDbCurrency.code != defaultCurrency.code) {
  2710.                         currensyList.push(defaultCurrency);
  2711.                         currensyList.push(currentDbCurrency);
  2712.                     }
  2713.                     this.collection = new Backbone.Collection(currensyList,{
  2714.                         model: Backbone.Model.extend({
  2715.                             initialize: function() {
  2716.                                 this.isSelected();
  2717.                             },
  2718.                             isSelected: function() {
  2719.                                 this.set('selected', (this.get('code').toLowerCase() == currentCurrency.toLowerCase()));
  2720.                             },
  2721.                             defaults: {
  2722.                                 sign: '',
  2723.                                 code: '',
  2724.                                 selected: false
  2725.                             }
  2726.                         })
  2727.                     });
  2728.                     this.render();
  2729.                 },
  2730.                 render: function() {
  2731.                     var CONF = this.CONF
  2732.                       , header_template = (typeof CONF.MIDDLE_WARE.new_design !== 'undefined' && CONF.MIDDLE_WARE.new_design === true)
  2733.                       , widgetTemplate = (header_template) ? CONTENT_TEMPLATE_NEW : CONTENT_TEMPLATE;
  2734.                     if (this.collection.length > 1) {
  2735.                         this.$el.html(_.template(widgetTemplate)({
  2736.                             LOCALE: CONF.LOCALE,
  2737.                             MIDDLE_WARE: CONF.MIDDLE_WARE,
  2738.                             data: this.collection
  2739.                         }));
  2740.                         if (!header_template) {
  2741.                             if (this.select2_support) {
  2742.                                 $('select', this.el).select2({
  2743.                                     minimumResultsForSearch: -1
  2744.                                 });
  2745.                             }
  2746.                         }
  2747.                     }
  2748.                 },
  2749.                 events: {
  2750.                     'click .js-drop-open': "openDropDown",
  2751.                     'click .js-btn-close': "_cancelHandler",
  2752.                     'click .js-btn-apply': "_selectCurrency",
  2753.                     'click .currency-switcher': "_openDropDownNew",
  2754.                     'click .js-switch-currency': "_headerSwitcher",
  2755.                     'click .js-currency-settings': 'stopClickEvents'
  2756.                 },
  2757.                 getCurrencyInfo: function(db) {
  2758.                     var info = countriesCurrency[db];
  2759.                     info.code = info.code.toLowerCase();
  2760.                     return info;
  2761.                 },
  2762.                 setCurrency: function(val) {
  2763.                     this.currentCurrency = val;
  2764.                     cookiesUtils.setCookie("db_currency", val, 365, document.domain);
  2765.                 },
  2766.                 select2_support: _.isFunction($.fn.select2),
  2767.                 _openDropDownNew: function(e) {
  2768.                     e.stopPropagation();
  2769.                     if ($(e.currentTarget).hasClass('-open')) {
  2770.                         $(document).off('click.dropdown');
  2771.                     } else {
  2772.                         $(document).on('click.dropdown', this.closeOnClickOutside.bind(this));
  2773.                         if (this.CONF.MIDDLE_WARE.gaCategory) {
  2774.                             ga('send', 'event', this.CONF.MIDDLE_WARE.gaCategory, 'currency', 'show');
  2775.                         }
  2776.                     }
  2777.                     $(e.currentTarget).toggleClass(' -open');
  2778.                     $(e.currentTarget).find('.s-select__toogle').toggleClass(' -open');
  2779.                 },
  2780.                 openDropDown: function(e) {
  2781.                     if ($(e.currentTarget).hasClass('-opened')) {
  2782.                         this._closeDropDown(e);
  2783.                     } else {
  2784.                         $(e.currentTarget).addClass('-opened');
  2785.                         $('.s-currency-selector__dropdown', this.el).addClass('-opened');
  2786.                         $(document).on('click.dropdown', this.closeOnClickOutside.bind(this));
  2787.                     }
  2788.                 },
  2789.                 _cancelHandler: function(e) {
  2790.                     this._closeDropDown(e);
  2791.                 },
  2792.                 _headerSwitcher: function(e) {
  2793.                     var currency = $(e.currentTarget).data('value');
  2794.                     $('.js-current-value', this.el).text(currency);
  2795.                     this.setCurrency(currency);
  2796.                     if (this.CONF.MIDDLE_WARE.gaCategory) {
  2797.                         ga('send', 'event', this.CONF.MIDDLE_WARE.gaCategory, 'currency', currency);
  2798.                     }
  2799.                     this._convertCurrency();
  2800.                 },
  2801.                 _selectCurrency: function(e) {
  2802.                     var currency = $('.js-currency-settings', this.el).find('select').val();
  2803.                     this.setCurrency(currency);
  2804.                     this._closeDropDown(e);
  2805.                     this._convertCurrency();
  2806.                 },
  2807.                 _closeDropDown: function(e) {
  2808.                     $('.js-drop-open', this.el).removeClass('-opened');
  2809.                     $('.s-currency-selector__dropdown', this.el).removeClass('-opened');
  2810.                     $('.currency-switcher', this.el).removeClass(' -open');
  2811.                     $('.currency-switcher', this.el).find('.s-select__toogle').removeClass(' -open');
  2812.                     $(document).off('click.dropdown');
  2813.                 },
  2814.                 _convertCurrency: function() {
  2815.                     location.reload();
  2816.                 },
  2817.                 closeOnClickOutside: function(e) {
  2818.                     this._closeDropDown(e);
  2819.                 },
  2820.                 stopClickEvents: function(e) {
  2821.                     e.stopPropagation();
  2822.                 }
  2823.             })
  2824.         }
  2825.         .apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  2826.         __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  2827.     }
  2828.     , function(module, exports) {
  2829.         module.exports = "<div class=\"js-currency-settings s-currency-settings\">\n\t<div class=\"js-drop-open\">\n\t\t<i class=\"s-icon -s -settings\"></i>\n\t</div>\n\t<div class=\"s-currency-selector__dropdown s-dropdown -dropdown-right\">\n\t\t<h3 class=\"s-dropdown__header -black\"><%= LOCALE.title %></h3>\n\t\t<div class=\"s-dropdown__body\">\n\t\t\t<select name=\"selector-currency\" class=\"sem-selector-currency\">\n\t\t\t\t<% _.forEach(data.models, function(item) { %>\n\t\t\t\t\t<option<% if(item.get('selected')) { %> selected=\"selected\"<% } %> value=\"<%= item.get('code') %>\">\n\t\t\t\t\t\t<%= item.get('code').toUpperCase() %>, <%= item.get('sign') %>\n\t\t\t\t\t</option>\n\t\t\t\t<% }); %>\n\t\t\t</select>\n\t\t</div>\n\t\t<div class=\"s-dropdown-btn\">\n\t\t\t<button class=\"s-btn -xs -hollow -default -btn-close js-btn-close\"><%= LOCALE.cancel %></button>\n\t\t\t<button class=\"s-btn -xs -success js-btn-apply\"><%= LOCALE.apply %></button>\n\t\t</div>\n\t</div>\n</div>"
  2830.     }
  2831.     , function(module, exports) {
  2832.         module.exports = "<div class=\"s-select -xs currency-switcher\">\n\t<div class=\"s-select__toogle\">\n\t\t<span class=\"s-btn__text s-link js-current-value\"><%= MIDDLE_WARE.db_currency %></span>\n\t\t<i class=\"s-icon -xxs -dropdown\"></i>\n\t</div>\n\t<div class=\"s-select__content\">\n\t\t<ul>\n\t\t\t<% _.forEach(data.models, function(item) { %>\n\t\t\t\t<li class=\"js-switch-currency s-select__item<% if(item.get('selected')) { %> -active<% } %>\" data-value=\"<%=  item.get('code') %>\">\n\t\t\t\t\t<%= item.get('code') %>, <%= item.get('sign') %>\n\t\t\t\t</li>\n\t\t\t<% }); %>\n\t\t</ul>\n\t</div>\n</div>"
  2833.     }
  2834.     , , , , , , function(module, exports) {
  2835.         module.exports = __WEBPACK_EXTERNAL_MODULE_29__;
  2836.     }
  2837.     , , , , , , , , , function(module, exports, __webpack_require__) {
  2838.         var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  2839.         !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(39), __webpack_require__(4), __webpack_require__(5)],
  2840.         __WEBPACK_AMD_DEFINE_RESULT__ = function(_, HEADER_TEMPLATE, Backbone) {
  2841.             "use strict";
  2842.             var getGaWidgetName = function(type) {
  2843.                 return (type === 'organic_organic' ? 'Organic' : 'Paid') + ' competitive positioning';
  2844.             }
  2845.             var gaClickOnTitle = function(type) {
  2846.                 sendGa(type, 'click to title');
  2847.             }
  2848.             var gaClickOnChart = function(type) {
  2849.                 sendGa(type, 'click to chart');
  2850.             }
  2851.             var sendGa = function(type, label) {
  2852.                 var action = getGaWidgetName(type);
  2853.                 if (typeof ga !== 'undefined') {
  2854.                     ga('send', 'event', 'Domain overview', action, label);
  2855.                 }
  2856.             }
  2857.             return Backbone.View.extend({
  2858.                 initialize: function(options, reportConfig) {
  2859.                     var CONF = this.CONF = options;
  2860.                     if (!CONF.MIDDLE_WARE.limit_display) {
  2861.                         CONF.MIDDLE_WARE.limit_display = 0;
  2862.                     }
  2863.                     this.reportConfig = {
  2864.                         el: $(CONF.EL),
  2865.                         title: CONF.LOCALE.title,
  2866.                         tooltip: CONF.LOCALE.title_tooltip,
  2867.                         title_href: app.conf.DB_PREFIX + app.conf.DB_DATE_PREFIX + "/info/" + CONF.MIDDLE_WARE.domain_id + "+(by+" + CONF.MIDDLE_WARE.type + ")",
  2868.                         MIDDLE_WARE: CONF.MIDDLE_WARE,
  2869.                         LOCALE: CONF.LOCALE,
  2870.                         needToLogNothingFound: true,
  2871.                         typeToLog: "domain_overview_" + CONF.MIDDLE_WARE.type,
  2872.                         gaLabel: getGaWidgetName(CONF.MIDDLE_WARE.type) + ' - Overview',
  2873.                         reports: [{
  2874.                             back: (function() {
  2875.                                 var foo = {
  2876.                                     key: app.conf.KEY,
  2877.                                     url: CONF.MIDDLE_WARE.backend_url,
  2878.                                     domain: CONF.MIDDLE_WARE.domain_id,
  2879.                                     action: "report",
  2880.                                     type: "domain_overview_" + CONF.MIDDLE_WARE.type,
  2881.                                     responceAction: "overview_" + CONF.MIDDLE_WARE.type,
  2882.                                     display_sort: "tr_desc"
  2883.                                 };
  2884.                                 if (CONF.MIDDLE_WARE.exportHash) {
  2885.                                     foo.display_hash = CONF.MIDDLE_WARE.exportHash;
  2886.                                 }
  2887.                                 if (CONF.MIDDLE_WARE.api_display_date && CONF.MIDDLE_WARE.api_display_date !== 'current') {
  2888.                                     foo.display_date = CONF.MIDDLE_WARE.api_display_date;
  2889.                                 }
  2890.                                 return foo;
  2891.                             }
  2892.                             )()
  2893.                         }, {
  2894.                             back: {
  2895.                                 key: app.conf.KEY,
  2896.                                 url: CONF.MIDDLE_WARE.backend_url,
  2897.                                 domain: CONF.MIDDLE_WARE.domain_id,
  2898.                                 action: "report",
  2899.                                 type: "domain_rank",
  2900.                                 responceAction: "rank"
  2901.                             }
  2902.                         }],
  2903.                         templates: {
  2904.                             widget: function() {
  2905.                                 var header = this.template("header")
  2906.                                   , footer = this.template("footer")
  2907.                                   , ret = "";
  2908.                                 if (header) {
  2909.                                     ret += "<div class=\"sem-widget-header\">" + header + "</div>";
  2910.                                 }
  2911.                                 ret += "<div class=\"sem-widget-content\">";
  2912.                                 ret += "<div class=\"sem-widget-loader\"></div>";
  2913.                                 if (this.noResults) {
  2914.                                     ret += this.template("noResults");
  2915.                                 } else if (this.serverError) {
  2916.                                     ret += this.template("serverError");
  2917.                                 } else {
  2918.                                     ret += this.template("content");
  2919.                                 }
  2920.                                 ret += "</div>";
  2921.                                 if (footer) {
  2922.                                     ret += "<div class=\"sem-widget-footer clearfix\">" + this.template("footer") + "</div>";
  2923.                                 }
  2924.                                 return ret;
  2925.                             },
  2926.                             header: (CONF.LOCALE.title && CONF.LOCALE.title !== "" ? HEADER_TEMPLATE : "")
  2927.                         },
  2928.                         chartOptions: {
  2929.                             colors: ['#afd3ed', '#7ac573', '#f599c3', '#f79052', '#7da5d9'],
  2930.                             chart: {
  2931.                                 backgroundColor: CONF.MIDDLE_WARE.show_watermark ? null : '#fff',
  2932.                                 type: 'bubble',
  2933.                                 height: CONF.MIDDLE_WARE.height,
  2934.                                 spacingTop: 27,
  2935.                                 spacingLeft: -5,
  2936.                                 spacingRight: 0,
  2937.                                 spacingBottom: 9
  2938.                             },
  2939.                             title: {
  2940.                                 text: null
  2941.                             },
  2942.                             legend: {
  2943.                                 enabled: false
  2944.                             },
  2945.                             tooltip: {
  2946.                                 formatter: function() {
  2947.                                     return "<strong>" + this.point.series.name + "</strong><br />" + CONF.LOCALE.tooltip_x + ": " + app.helper.roundNumRankNew(this.point.x) + "<br />" + CONF.LOCALE.tooltip_y + ": " + app.helper.roundNumRankNew(this.point.y);
  2948.                                 }
  2949.                             },
  2950.                             xAxis: {
  2951.                                 min: -1,
  2952.                                 minTickInterval: 1,
  2953.                                 gridLineWidth: 0,
  2954.                                 tickPixelInterval: 200,
  2955.                                 showFirstLabel: false,
  2956.                                 title: {
  2957.                                     align: "low",
  2958.                                     text: CONF.LOCALE.title_x,
  2959.                                     margin: -7,
  2960.                                     style: {
  2961.                                         color: '#53a5e0',
  2962.                                         fontFamily: 'Ubuntu, Arial',
  2963.                                         fontSize: 12
  2964.                                     }
  2965.                                 },
  2966.                                 lineColor: '#cccccc',
  2967.                                 labels: {
  2968.                                     y: 20,
  2969.                                     style: {
  2970.                                         fontSize: 12,
  2971.                                         color: '#999999'
  2972.                                     },
  2973.                                     formatter: function() {
  2974.                                         return (app.helper.roundNumRankNew(this.value) + '').toUpperCase();
  2975.                                     }
  2976.                                 },
  2977.                                 tickWidth: 0,
  2978.                                 type: "linear"
  2979.                             },
  2980.                             yAxis: {
  2981.                                 labels: {
  2982.                                     x: 0,
  2983.                                     y: -5,
  2984.                                     align: "left",
  2985.                                     style: {
  2986.                                         fontSize: 12,
  2987.                                         color: '#999999'
  2988.                                     },
  2989.                                     formatter: function() {
  2990.                                         return (app.helper.roundNumRankNew(this.value) + '').toUpperCase();
  2991.                                     }
  2992.                                 },
  2993.                                 title: {
  2994.                                     text: CONF.LOCALE.title_y,
  2995.                                     x: 5,
  2996.                                     style: {
  2997.                                         color: '#53a5e0',
  2998.                                         fontFamily: 'Ubuntu, Arial',
  2999.                                         fontSize: 12
  3000.                                     }
  3001.                                 },
  3002.                                 type: "logarithmic",
  3003.                                 min: 0
  3004.                             },
  3005.                             plotOptions: {
  3006.                                 bubble: {
  3007.                                     minSize: '15%',
  3008.                                     maxSize: '35%',
  3009.                                     dataLabels: {
  3010.                                         enabled: true,
  3011.                                         formatter: function() {
  3012.                                             return this.series.name;
  3013.                                         },
  3014.                                         rotation: 35,
  3015.                                         style: {
  3016.                                             textShadow: 'none',
  3017.                                             color: '#333333'
  3018.                                         },
  3019.                                         crop: false,
  3020.                                         overflow: "none"
  3021.                                     }
  3022.                                 },
  3023.                                 series: {
  3024.                                     events: {
  3025.                                         click: function(event) {
  3026.                                             gaClickOnChart(CONF.MIDDLE_WARE.type);
  3027.                                             document.location = app.conf.DB_PREFIX + app.conf.DB_DATE_PREFIX + "/info/" + event.point.series.name;
  3028.                                         }
  3029.                                     }
  3030.                                 }
  3031.                             }
  3032.                         },
  3033.                         getData: function(backendReports) {
  3034.                             var backendModel, backendModelR, ret = [], min, keywords = CONF.MIDDLE_WARE.type == "organic_organic" ? "Or" : "Ad", traffic = CONF.MIDDLE_WARE.type == "organic_organic" ? "Ot" : "At";
  3035.                             _.each(backendReports.toJSON(), function(model) {
  3036.                                 if (model.type === "domain_rank" && typeof model.responce.attributes !== "undefined") {
  3037.                                     backendModelR = model;
  3038.                                 } else if (model.type === "domain_overview_" + CONF.MIDDLE_WARE.type && typeof model.responce.attributes !== "undefined") {
  3039.                                     backendModel = model;
  3040.                                 }
  3041.                             });
  3042.                             if (typeof backendModel !== "undefined" && backendModel.length) {
  3043.                                 min = parseInt(backendModel.first().get(traffic), 10);
  3044.                                 _.map(backendModel.models, function(item) {
  3045.                                     if (ret.length < 10) {
  3046.                                         ret.push({
  3047.                                             name: item.get("Dn"),
  3048.                                             data: [[parseInt(item.get(keywords), 10), parseInt(item.get(traffic), 10) ? parseInt(item.get(traffic), 10) : 0.00001, parseInt(item.get(traffic), 10) ? parseInt(item.get(traffic), 10) : 0.00001]]
  3049.                                         });
  3050.                                     }
  3051.                                     if (min > parseInt(item.get(traffic), 10)) {
  3052.                                         min = parseInt(item.get(traffic), 10);
  3053.                                     }
  3054.                                 })
  3055.                             }
  3056.                             this.options.chartOptions.yAxis.min = min || 1;
  3057.                             if (typeof backendModelR !== "undefined" && backendModelR.length) {
  3058.                                 ret.push({
  3059.                                     name: backendModelR.first().get("Dn"),
  3060.                                     data: [[parseInt(backendModelR.first().get(keywords), 10), parseInt(backendModelR.first().get(traffic), 10) ? parseInt(backendModelR.first().get(traffic), 10) : 0.00001, parseInt(backendModelR.first().get(traffic), 10) ? parseInt(backendModelR.first().get(traffic), 10) : 0.00001]],
  3061.                                     marker: {
  3062.                                         lineWidth: 3
  3063.                                     }
  3064.                                 });
  3065.                             }
  3066.                             return ret;
  3067.                         }
  3068.                     };
  3069.                     if (reportConfig) {
  3070.                         app.deepExtend(this.reportConfig, reportConfig);
  3071.                     }
  3072.                     return this.render();
  3073.                 },
  3074.                 render: function() {
  3075.                     var CONF = this.CONF;
  3076.                     return new (app.ReportChart.extend({
  3077.                         events: {
  3078.                             "click .sem-widget-try-again": "tryAgainHandler",
  3079.                             'click .sem-widget-header-title a': function(e) {
  3080.                                 gaClickOnTitle(CONF.MIDDLE_WARE.type);
  3081.                             },
  3082.                         }
  3083.                     }))(this.reportConfig);
  3084.                 }
  3085.             });
  3086.         }
  3087.         .apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  3088.         __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  3089.     }
  3090.     , function(module, exports) {
  3091.         module.exports = "<% if (typeof options.title != \"undefined\") { %>\n\t<h3 class=\"sem-widget-header-title\">\n\t\t<% if (typeof options.title_href != \"undefined\") { %><a href=\"<%= options.title_href %>\"><% } %><%= options.title %><% if (typeof options.title_href != \"undefined\") { %></a><% } %>\n\t\t<% if (typeof data.responce != \"undefined\" && typeof data.responce.get != \"undefined\" && parseInt(data.responce.get(\"total\"), 10) > 0 && data.length > 0) { %>\n\t\t\t(<%= helper.breakToThreeComa(data.responce.get(\"total\")) %>)\n\t\t<% } %>\n\t\t<% if (typeof options.tooltip != \"undefined\") { %>\n\t\t\t<div class=\"sem-report-title-info sem-report-with-tooltip\">\n\t\t\t\t<div class=\"sem-report-title-info-description sem-report-tooltip-down<%= (typeof options.tooltip_position !== 'undefined') ? ' -right' : '' %>\">\n\t\t\t\t\t<%= options.tooltip %>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t<% } %>\n\t</h3>\n<% } else { %>\n<div>&nbsp;</div>\n<% } %>\n"
  3092.     }
  3093.     , , , , , , function(module, exports, __webpack_require__) {
  3094.         var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  3095.         !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(46), __webpack_require__(47), __webpack_require__(4), __webpack_require__(17), __webpack_require__(5)],
  3096.         __WEBPACK_AMD_DEFINE_RESULT__ = function(_, TOOLTIP_TEMPLATE, HEADER_TEMPLATE, Backbone, cookiesUtils) {
  3097.             "use strict";
  3098.             var gaClickOnChart = function(type, range, value) {
  3099.                 var action = 'Click on chart';
  3100.                 var date = value.getUTCDate() + '.' + (value.getUTCMonth() + 1) + '.' + value.getUTCFullYear();
  3101.                 var label = 'click to ' + type + ' traffic - ' + range + ' - ' + date;
  3102.                 if (typeof ga !== 'undefined') {
  3103.                     ga('send', 'event', 'Domain overview', action, label);
  3104.                 }
  3105.             }
  3106.             return Backbone.View.extend({
  3107.                 initialize: function(options, reportConfig) {
  3108.                     cookiesUtils.deleteCookie("selectedVsTypeLine");
  3109.                     cookiesUtils.deleteCookie("selectedTypeLine");
  3110.                     cookiesUtils.deleteCookie("selectedTypeDate");
  3111.                     var CONF = this.CONF = options
  3112.                       , _this = this;
  3113.                     if (_.indexOf(CONF.MIDDLE_WARE.typeLine, CONF.MIDDLE_WARE.selectedTypeLine) == -1) {
  3114.                         if (CONF.MIDDLE_WARE.selectedTypeLine == 'Ad') {
  3115.                             CONF.MIDDLE_WARE.selectedTypeLine = 'Or';
  3116.                         } else if (CONF.MIDDLE_WARE.selectedTypeLine == 'Or') {
  3117.                             CONF.MIDDLE_WARE.selectedTypeLine = 'Ad';
  3118.                         } else {
  3119.                             CONF.MIDDLE_WARE.selectedTypeLine = _.first(CONF.MIDDLE_WARE.typeLine);
  3120.                         }
  3121.                     }
  3122.                     var clickOnChart = function(event) {
  3123.                         var date = new Date(event.point.x);
  3124.                         var gaType;
  3125.                         var href = CONF.MIDDLE_WARE.db_prefix;
  3126.                         if (CONF.MIDDLE_WARE.selectedTypeDate !== "30d") {
  3127.                             href += "/" + date.getUTCFullYear() + ("0" + (date.getUTCMonth() + 1)).slice(-2);
  3128.                         }
  3129.                         href += "/info/" + CONF.MIDDLE_WARE.domain_id + "+(by+";
  3130.                         switch (event.currentTarget.options.className.substr(0, 1)) {
  3131.                         case "O":
  3132.                             href += "organic)";
  3133.                             gaType = 'organic';
  3134.                             break;
  3135.                         case "A":
  3136.                             href += "adwords)";
  3137.                             gaType = 'paid';
  3138.                             break;
  3139.                         default:
  3140.                             href += "shopping)";
  3141.                             gaType = 'pla';
  3142.                         }
  3143.                         gaClickOnChart(gaType, CONF.MIDDLE_WARE.selectedTypeDate, date);
  3144.                         if (CONF.MIDDLE_WARE.selectedTypeDate == "30d") {
  3145.                             href += "?date=" + date.getUTCFullYear() + ("0" + (date.getUTCMonth() + 1)).slice(-2) + ("0" + date.getUTCDate()).slice(-2);
  3146.                             if (event.currentTarget.options.className.substr(0, 1) == "S") {
  3147.                                 return;
  3148.                             }
  3149.                         }
  3150.                         document.location = href;
  3151.                     };
  3152.                     var prepareDataLine = function(backendReports, typeLine, typeDate) {
  3153.                         var data, postfixes = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a"];
  3154.                         if (typeof typeLine != "undefined") {
  3155.                             var minDate = new Date(), ndate;
  3156.                             minDate.setDate(minDate.getDate() - 1);
  3157.                             switch (typeDate) {
  3158.                             case "2y":
  3159.                                 minDate.setMonth(minDate.getMonth() - 24);
  3160.                                 break;
  3161.                             case "1y":
  3162.                                 minDate.setMonth(minDate.getMonth() - 12);
  3163.                                 break;
  3164.                             case "6m":
  3165.                                 minDate.setMonth(minDate.getMonth() - 6);
  3166.                                 break;
  3167.                             case "30d":
  3168.                                 minDate.setMonth(minDate.getMonth() - 1);
  3169.                                 break;
  3170.                             default:
  3171.                                 minDate.setYear(1970);
  3172.                             }
  3173.                             data = _.compact(backendReports.models.map(function(val, index) {
  3174.                                 var retval = [];
  3175.                                 if (typeof val.get("Dt") != "undefined") {
  3176.                                     ndate = new Date(Date.parse(val.get("Dt").replace(/^(\d{4})(\d{2})(\d{2})$/, "$1/$2/$3 12:00:00")));
  3177.                                 } else {
  3178.                                     ndate = new Date();
  3179.                                 }
  3180.                                 if (typeDate != "30d") {
  3181.                                     ndate.setDate(1);
  3182.                                 }
  3183.                                 retval.push(Date.UTC(ndate.getFullYear(), ndate.getMonth(), ndate.getDate()));
  3184.                                 if (typeLine != "Or" && typeLine != "Ad") {
  3185.                                     var res = parseInt(val.get(typeLine), 10);
  3186.                                     if (typeLine === 'At' && typeDate === '30d') {
  3187.                                         res = _.isNaN(res) ? 0 : res;
  3188.                                     }
  3189.                                     retval.push(res);
  3190.                                 }
  3191.                                 var keywords = 0, j;
  3192.                                 if (typeof _this.selectedVsTypeLine == "undefined" && CONF.MIDDLE_WARE.show_positions && typeLine == "Ad") {
  3193.                                     for (j = 0; j < postfixes.length; j++) {
  3194.                                         if (j === 3 || j === 8) {
  3195.                                             retval.push(keywords);
  3196.                                             keywords = 0;
  3197.                                         }
  3198.                                         keywords += parseInt(val.get("Y" + postfixes[j]));
  3199.                                     }
  3200.                                     retval.push(keywords);
  3201.                                 } else if (typeof _this.selectedVsTypeLine == "undefined" && CONF.MIDDLE_WARE.show_positions && typeLine == "Or") {
  3202.                                     for (j = 0; j < postfixes.length; j++) {
  3203.                                         if (j < 3) {
  3204.                                             retval.push(parseInt(val.get("X" + postfixes[j])));
  3205.                                         }
  3206.                                         if (j >= 3 && j < 5) {
  3207.                                             keywords += parseInt(val.get("X" + postfixes[j]));
  3208.                                         }
  3209.                                         if (j == 5) {
  3210.                                             keywords += parseInt(val.get("X" + postfixes[j]));
  3211.                                             retval.push(keywords);
  3212.                                             keywords = 0;
  3213.                                         }
  3214.                                         if (j > 5) {
  3215.                                             keywords += parseInt(val.get("X" + postfixes[j]));
  3216.                                         }
  3217.                                         if (postfixes[j] == 'a') {
  3218.                                             retval.push(keywords);
  3219.                                         }
  3220.                                     }
  3221.                                 }
  3222.                                 if (ndate > minDate && !isNaN(retval[1])) {
  3223.                                     return retval;
  3224.                                 } else {
  3225.                                     return null;
  3226.                                 }
  3227.                             }));
  3228.                             data = _.sortBy(data, function(arr) {
  3229.                                 return arr[0];
  3230.                             });
  3231.                         }
  3232.                         if (typeof data !== "undefined" && data.length) {
  3233.                             return data;
  3234.                         } else {
  3235.                             return false;
  3236.                         }
  3237.                     };
  3238.                     this.reportConfig = {
  3239.                         el: $(CONF.EL),
  3240.                         title: CONF.LOCALE.title,
  3241.                         MIDDLE_WARE: CONF.MIDDLE_WARE,
  3242.                         LOCALE: CONF.LOCALE,
  3243.                         reports: [{
  3244.                             back: function() {
  3245.                                 var foo = {
  3246.                                     key: app.conf.KEY,
  3247.                                     url: CONF.MIDDLE_WARE.backend_url,
  3248.                                     domain: CONF.MIDDLE_WARE.domain_id,
  3249.                                     display_hash: CONF.MIDDLE_WARE.exportHash,
  3250.                                     action: "report",
  3251.                                     type: "domain_rank_history",
  3252.                                     display_sort: 'dt_desc',
  3253.                                     responceAction: "rank_history"
  3254.                                 };
  3255.                                 if (CONF.MIDDLE_WARE.db_currency) {
  3256.                                     foo.currency = CONF.MIDDLE_WARE.db_currency;
  3257.                                 }
  3258.                                 return foo;
  3259.                             }()
  3260.                         }, {
  3261.                             back: function() {
  3262.                                 var foo = {
  3263.                                     key: app.conf.KEY,
  3264.                                     url: CONF.MIDDLE_WARE.backend_url,
  3265.                                     domain: CONF.MIDDLE_WARE.domain_id,
  3266.                                     display_hash: CONF.MIDDLE_WARE.exportHash,
  3267.                                     action: "report",
  3268.                                     type: "domain_rank_history",
  3269.                                     responceAction: "rank_history",
  3270.                                     display_sort: 'dt_desc',
  3271.                                     display_daily: "1"
  3272.                                 };
  3273.                                 if (CONF.MIDDLE_WARE.db_currency) {
  3274.                                     foo.currency = CONF.MIDDLE_WARE.db_currency;
  3275.                                 }
  3276.                                 return foo;
  3277.                             }()
  3278.                         }, {
  3279.                             back: function() {
  3280.                                 var foo = {
  3281.                                     key: app.conf.KEY,
  3282.                                     url: CONF.MIDDLE_WARE.backend_url,
  3283.                                     domain: CONF.MIDDLE_WARE.domain_id,
  3284.                                     display_hash: CONF.MIDDLE_WARE.exportHashR,
  3285.                                     action: "report",
  3286.                                     type: "domain_rank",
  3287.                                     responceAction: "rank"
  3288.                                 };
  3289.                                 if (CONF.MIDDLE_WARE.db_currency) {
  3290.                                     foo.currency = CONF.MIDDLE_WARE.db_currency;
  3291.                                 }
  3292.                                 return foo;
  3293.                             }()
  3294.                         }],
  3295.                         chartOptions: {
  3296.                             chart: {
  3297.                                 backgroundColor: CONF.MIDDLE_WARE.show_watermark ? null : '#fff',
  3298.                                 zoomType: "xy",
  3299.                                 height: CONF.MIDDLE_WARE.height,
  3300.                                 spacingTop: 10,
  3301.                                 spacingLeft: 0,
  3302.                                 spacingRight: 0,
  3303.                                 spacingBottom: 10,
  3304.                                 events: {
  3305.                                     load: function(event) {
  3306.                                         var seriesIndex = this.series.length - 1, j, i;
  3307.                                         if (CONF.MIDDLE_WARE.display_filter_param) {
  3308.                                             for (i = 0; i < this.series.length; i++) {
  3309.                                                 if (encodeURIComponent(this.series[i].options.filter) === CONF.MIDDLE_WARE.display_filter_param) {
  3310.                                                     seriesIndex = i;
  3311.                                                 }
  3312.                                             }
  3313.                                         }
  3314.                                         if (CONF.MIDDLE_WARE.selectedTypeDate == "30d" && CONF.MIDDLE_WARE.display_date) {
  3315.                                             if (CONF.MIDDLE_WARE.db_date === "current") {
  3316.                                                 for (i = 0; i < this.series[seriesIndex].data.length; i++) {
  3317.                                                     if (this.series[seriesIndex].data[i]["x"] == CONF.MIDDLE_WARE.display_date_ts) {
  3318.                                                         this.series[seriesIndex].data[i].select();
  3319.                                                         return;
  3320.                                                     }
  3321.                                                     ;
  3322.                                                 }
  3323.                                                 ;
  3324.                                             }
  3325.                                         } else if (CONF.MIDDLE_WARE.selectedTypeDate != "30d") {
  3326.                                             for (i = 0; i < this.series[0].data.length; i++) {
  3327.                                                 if (this.series[0].data[i]["x"] === CONF.MIDDLE_WARE.db_date) {
  3328.                                                     this.series[0].data[i].select();
  3329.                                                     return;
  3330.                                                 }
  3331.                                                 ;
  3332.                                             }
  3333.                                         } else if (CONF.MIDDLE_WARE.display_date) {
  3334.                                             this.series[seriesIndex].data[this.series[seriesIndex].data.length - 1].select();
  3335.                                         }
  3336.                                         var topLine, _this = this;
  3337.                                         _.each(_this.series, function(item) {
  3338.                                             if (item.options.id == 'keywordsTopLine') {
  3339.                                                 topLine = item;
  3340.                                             }
  3341.                                         });
  3342.                                         if (topLine) {
  3343.                                             _.map(topLine.points, function(item, i) {
  3344.                                                 var sum = 0;
  3345.                                                 _.each(_this.series, function(serie) {
  3346.                                                     if (item.options.id != 'keywordsTopLine') {
  3347.                                                         sum = sum + serie.points[i].y;
  3348.                                                     }
  3349.                                                 });
  3350.                                                 item.y = sum;
  3351.                                             });
  3352.                                             _this.series[topLine.index] = topLine;
  3353.                                         }
  3354.                                         _this.redraw();
  3355.                                     }
  3356.                                 }
  3357.                             },
  3358.                             title: {
  3359.                                 text: null
  3360.                             },
  3361.                             plotOptions: {
  3362.                                 series: {
  3363.                                     marker: {
  3364.                                         radius: 3,
  3365.                                         lineWidth: 1,
  3366.                                         lineColor: "#fff",
  3367.                                         states: {
  3368.                                             select: {
  3369.                                                 radius: 4,
  3370.                                                 lineWidth: 1,
  3371.                                                 fillColor: "#f7931e",
  3372.                                                 lineColor: "#fff"
  3373.                                             }
  3374.                                         }
  3375.                                     },
  3376.                                     states: {
  3377.                                         select: {
  3378.                                             color: "#f7931e",
  3379.                                             borderColor: "#fff"
  3380.                                         }
  3381.                                     },
  3382.                                     shadow: false
  3383.                                 },
  3384.                                 column: {
  3385.                                     stacking: "normal",
  3386.                                     pointWidth: (CONF.MIDDLE_WARE.selectedTypeDate == "30d") ? 10 : (CONF.MIDDLE_WARE.selectedTypeDate == "all") ? 5 : (CONF.MIDDLE_WARE.selectedTypeDate == "6m") ? 23 : 10,
  3387.                                     events: {
  3388.                                         legendItemClick: function() {
  3389.                                             var topLine, _this = this;
  3390.                                             _.each(_this.chart.series, function(item) {
  3391.                                                 if (item.options.id == 'keywordsTopLine') {
  3392.                                                     topLine = item;
  3393.                                                 }
  3394.                                             });
  3395.                                             if (topLine) {
  3396.                                                 _.map(topLine.points, function(item, i) {
  3397.                                                     if (_this.visible) {
  3398.                                                         item.y = item.y - _this.points[i].y;
  3399.                                                     } else {
  3400.                                                         item.y = item.y + _this.points[i].y;
  3401.                                                     }
  3402.                                                 });
  3403.                                                 _this.chart.series[topLine.index] = topLine;
  3404.                                             }
  3405.                                         },
  3406.                                         click: function(event) {
  3407.                                             var date = new Date(event.point.x), reportType, gaType;
  3408.                                             switch (CONF.MIDDLE_WARE.selectedTypeLine.substr(0, 1)) {
  3409.                                             case "O":
  3410.                                                 reportType = "by organic";
  3411.                                                 gaType = "organic";
  3412.                                                 break;
  3413.                                             case "A":
  3414.                                                 reportType = "by adwords";
  3415.                                                 gaType = "paid";
  3416.                                                 break;
  3417.                                             default:
  3418.                                                 reportType = "by shopping";
  3419.                                                 gaType = "shopping";
  3420.                                             }
  3421.                                             if (CONF.MIDDLE_WARE.user_with_product) {
  3422.                                                 if (event.point.series.options.filter) {
  3423.                                                     if (CONF.MIDDLE_WARE.selectedTypeDate !== "30d") {
  3424.                                                         document.location = CONF.MIDDLE_WARE.db_prefix + "/" + date.getUTCFullYear() + ("0" + (date.getUTCMonth() + 1)).slice(-2) + "/info/" + CONF.MIDDLE_WARE.domain_id + " (" + reportType + ")?filter=" + encodeURIComponent(event.point.series.options.filter);
  3425.                                                     } else {
  3426.                                                         document.location = CONF.MIDDLE_WARE.db_prefix + "/info/" + CONF.MIDDLE_WARE.domain_id + " (" + reportType + ")?date=" + date.getUTCFullYear() + ("0" + (date.getUTCMonth() + 1)).slice(-2) + ("0" + date.getUTCDate()).slice(-2) + "&filter=" + encodeURIComponent(event.point.series.options.filter);
  3427.                                                     }
  3428.                                                 }
  3429.                                             } else {
  3430.                                                 document.location = "/limit/";
  3431.                                             }
  3432.                                         }
  3433.                                     }
  3434.                                 },
  3435.                                 areaspline: {
  3436.                                     fillColor: "rgba(204, 233, 253, 0.75)",
  3437.                                     fillOpacity: 0.5,
  3438.                                     events: {
  3439.                                         click: function(event) {
  3440.                                             return clickOnChart(event);
  3441.                                         }
  3442.                                     }
  3443.                                 },
  3444.                                 spline: {
  3445.                                     events: {
  3446.                                         click: function(event) {
  3447.                                             return clickOnChart(event);
  3448.                                         }
  3449.                                     }
  3450.                                 }
  3451.                             },
  3452.                             xAxis: {
  3453.                                 type: "datetime",
  3454.                                 gridLineWidth: 0,
  3455.                                 gridLineColor: "#e0e0e0",
  3456.                                 labels: {
  3457.                                     formatter: function() {
  3458.                                         if (CONF.MIDDLE_WARE.selectedTypeDate == "30d")
  3459.                                             return Highcharts.dateFormat("%e %b", this.value);
  3460.                                         else
  3461.                                             return Highcharts.dateFormat("%b'%y", this.value);
  3462.                                     },
  3463.                                     y: 20,
  3464.                                     style: {
  3465.                                         fontSize: 11,
  3466.                                         color: '#999999'
  3467.                                     }
  3468.                                 },
  3469.                                 minTickInterval: (function() {
  3470.                                     if (CONF.MIDDLE_WARE.selectedTypeDate == "30d")
  3471.                                         return 4 * 24 * 3600 * 1000;
  3472.                                     else
  3473.                                         return 31 * 24 * 3600 * 1000;
  3474.                                 }
  3475.                                 )(),
  3476.                                 tickWidth: 0
  3477.                             },
  3478.                             yAxis: {
  3479.                                 min: 0,
  3480.                                 gridLineWidth: 1,
  3481.                                 gridLineColor: "#ccc",
  3482.                                 title: {
  3483.                                     text: null
  3484.                                 },
  3485.                                 labels: {
  3486.                                     style: {
  3487.                                         fontSize: 11,
  3488.                                         color: '#999999'
  3489.                                     },
  3490.                                     formatter: function() {
  3491.                                         var i = parseInt(this.value, 10);
  3492.                                         if (isNaN(i))
  3493.                                             return 0;
  3494.                                         if (i < 1000)
  3495.                                             return i;
  3496.                                         else if (i < 1000000)
  3497.                                             return (i / 1000).toFixed(1) + 'K';
  3498.                                         else if (i < 1000000000)
  3499.                                             return (i / 1000000).toFixed(1) + 'M';
  3500.                                         else
  3501.                                             return (i / 1000000000).toFixed(1) + 'B';
  3502.                                     }
  3503.                                 },
  3504.                                 showFirstLabel: false,
  3505.                                 minRange: 1,
  3506.                                 minTickInterval: 1
  3507.                             },
  3508.                             tooltip: {
  3509.                                 shared: true,
  3510.                                 useHTML: true,
  3511.                                 hideDelay: 100,
  3512.                                 snap: 0,
  3513.                                 style: {
  3514.                                     padding: '10px',
  3515.                                     fontSize: '12px',
  3516.                                     fontFamily: 'Ubuntu'
  3517.                                 },
  3518.                                 formatter: function() {
  3519.                                     var dateFormat = (CONF.MIDDLE_WARE.selectedTypeDate == "30d") ? "%e %b %Y" : "%b %Y";
  3520.                                     _.remove(this.points, function(point) {
  3521.                                         return point.series.options.id === 'keywordsTopLine';
  3522.                                     });
  3523.                                     return _.template(TOOLTIP_TEMPLATE)({
  3524.                                         title: Highcharts.dateFormat(dateFormat, this.x),
  3525.                                         data: this.points,
  3526.                                         show_positions: (CONF.MIDDLE_WARE.selectedTypeLine == 'Or' || CONF.MIDDLE_WARE.selectedTypeLine == 'Ad'),
  3527.                                         LOCALE: CONF.LOCALE
  3528.                                     });
  3529.                                 }
  3530.                             },
  3531.                             legend: {
  3532.                                 enabled: true,
  3533.                                 borderWidth: 0,
  3534.                                 symbolHeight: 15,
  3535.                                 symbolWidth: 15,
  3536.                                 symbolRadius: 1
  3537.                             }
  3538.                         },
  3539.                         getData: function(backendReports) {
  3540.                             var data, dataVs, ret = [], backendModel, backendModelD, backendModelR, selectedTypeLine = this.selectedTypeLine, selectedVsTypeLine = this.selectedVsTypeLine, selectedTypeDate = this.selectedTypeDate, color, colorVs;
  3541.                             _.each(backendReports.toJSON(), function(model) {
  3542.                                 if (model.type === "domain_rank" && typeof model.responce.attributes !== "undefined") {
  3543.                                     backendModelR = model;
  3544.                                 }
  3545.                                 if (model.type === "domain_rank_history" && typeof model.responce.attributes !== "undefined") {
  3546.                                     if (typeof model.display_daily == "undefined") {
  3547.                                         backendModel = model;
  3548.                                     } else {
  3549.                                         backendModelD = model;
  3550.                                     }
  3551.                                 }
  3552.                             });
  3553.                             if ((CONF.MIDDLE_WARE.selectedTypeDate != "30d" && typeof backendModel !== "undefined" && typeof backendModelR !== "undefined") || (CONF.MIDDLE_WARE.selectedTypeDate == "30d" && typeof backendModelD !== "undefined" && backendModelD.length)) {
  3554.                                 if (CONF.MIDDLE_WARE.selectedTypeDate != "30d" && backendModelR.length) {
  3555.                                     if (backendModel.length && parseInt(backendModel.last().get("Dt")) < parseInt(CONF.MIDDLE_WARE.last_update_date)) {
  3556.                                         backendModel.push(backendModelR.first());
  3557.                                     }
  3558.                                 }
  3559.                                 if (selectedTypeDate == "30d") {
  3560.                                     data = prepareDataLine(backendModelD, selectedTypeLine, selectedTypeDate);
  3561.                                     dataVs = prepareDataLine(backendModelD, selectedVsTypeLine, selectedTypeDate);
  3562.                                 } else {
  3563.                                     data = prepareDataLine(backendModel, selectedTypeLine, selectedTypeDate);
  3564.                                     dataVs = prepareDataLine(backendModel, selectedVsTypeLine, selectedTypeDate);
  3565.                                 }
  3566.                                 if (CONF.MIDDLE_WARE.typeLine.length > 3) {
  3567.                                     if (selectedTypeLine.substring(0, 1) == "O")
  3568.                                         color = "#2D76B8";
  3569.                                     else if (selectedTypeLine.substring(0, 1) == "A")
  3570.                                         color = "#F7722A";
  3571.                                     else
  3572.                                         color = "#EC5397";
  3573.                                 } else {
  3574.                                     color = "#2D76B8";
  3575.                                 }
  3576.                                 if (selectedTypeLine && selectedTypeLine !== "Or" && selectedTypeLine !== "Ad") {
  3577.                                     ret.push({
  3578.                                         name: CONF.LOCALE[selectedTypeLine],
  3579.                                         className: selectedTypeLine,
  3580.                                         type: "spline",
  3581.                                         data: _.map(data, function(arr) {
  3582.                                             return [arr[0], arr[1]];
  3583.                                         }),
  3584.                                         index: 10,
  3585.                                         color: color
  3586.                                     });
  3587.                                 }
  3588.                                 if (typeof selectedVsTypeLine != "undefined" && selectedVsTypeLine) {
  3589.                                     if (CONF.MIDDLE_WARE.typeLine.length > 3) {
  3590.                                         if (selectedVsTypeLine.substring(0, 1) == "O")
  3591.                                             colorVs = "#61A6DD";
  3592.                                         else if (selectedVsTypeLine.substring(0, 1) == "A")
  3593.                                             colorVs = "#F6A57A";
  3594.                                         else
  3595.                                             colorVs = "#F2A3D0";
  3596.                                     } else {
  3597.                                         colorVs = "#F7722A";
  3598.                                     }
  3599.                                     ret.push({
  3600.                                         name: CONF.LOCALE[selectedVsTypeLine],
  3601.                                         className: selectedVsTypeLine,
  3602.                                         type: "spline",
  3603.                                         data: _.map(dataVs, function(arr) {
  3604.                                             return [arr[0], arr[1]];
  3605.                                         }),
  3606.                                         index: 10,
  3607.                                         color: colorVs
  3608.                                     });
  3609.                                 } else if (!CONF.MIDDLE_WARE.show_positions || (selectedTypeLine !== "Or" && selectedTypeLine !== "Ad")) {
  3610.                                     ret[0].type = "areaspline";
  3611.                                 }
  3612.                                 if (typeof selectedVsTypeLine == "undefined" && CONF.MIDDLE_WARE.show_positions && (selectedTypeLine == "Or" || selectedTypeLine == "Ad")) {
  3613.                                     var groupCnt = (selectedTypeLine == "Or" && CONF.MIDDLE_WARE.keywords_positions == '100') ? 5 : 3;
  3614.                                     var colors = ['250, 187, 50', '221, 237, 249', '178, 216, 240', '131, 181, 225', '121, 157, 193'];
  3615.                                     for (var i = 1; i <= groupCnt; i++) {
  3616.                                         var j = (selectedTypeLine == "Or" || selectedTypeLine == "Ad") ? i : i + 1;
  3617.                                         ret.push({
  3618.                                             name: CONF.LOCALE['keywords_group_' + i],
  3619.                                             type: "column",
  3620.                                             data: _.map(data, function(arr) {
  3621.                                                 return [arr[0], arr[j]];
  3622.                                             }),
  3623.                                             filter: CONF.MIDDLE_WARE['filter' + i],
  3624.                                             reportType: CONF.MIDDLE_WARE['reportType' + i],
  3625.                                             borderWidth: 1,
  3626.                                             groupPadding: 0,
  3627.                                             color: 'rgba(' + colors[i - 1] + ', 0.75)'
  3628.                                         });
  3629.                                     }
  3630.                                     if (selectedTypeLine == "Or" || selectedTypeLine == "Ad") {
  3631.                                         ret.push({
  3632.                                             id: 'keywordsTopLine',
  3633.                                             type: "spline",
  3634.                                             name: CONF.LOCALE[selectedTypeLine],
  3635.                                             className: selectedTypeLine,
  3636.                                             data: _.map(data, function(arr) {
  3637.                                                 return [arr[0], 0];
  3638.                                             }),
  3639.                                             zIndex: 10
  3640.                                         });
  3641.                                     }
  3642.                                 }
  3643.                             }
  3644.                             if (ret && ret[0] && ret[0].data.length) {
  3645.                                 this.options.chartOptions.legend.enabled = (CONF.MIDDLE_WARE.show_positions && (CONF.MIDDLE_WARE.selectedTypeLine == "Or" || CONF.MIDDLE_WARE.selectedTypeLine == "Ad"));
  3646.                                 return ret;
  3647.                             } else {
  3648.                                 this.options.chartOptions.legend.enabled = false;
  3649.                                 return [{}];
  3650.                             }
  3651.                         },
  3652.                         templates: {
  3653.                             header: function() {
  3654.                                 var showSelector = false
  3655.                                   , customSelector = false;
  3656.                                 if (CONF.MIDDLE_WARE.typeLine.length) {
  3657.                                     if (typeof this.selectedVsTypeLine != "undefined") {
  3658.                                         if (CONF.MIDDLE_WARE.typeLine.length > 2) {
  3659.                                             showSelector = true;
  3660.                                         }
  3661.                                     } else {
  3662.                                         customSelector = (CONF.MIDDLE_WARE.typeLine.length <= 3);
  3663.                                         if (CONF.MIDDLE_WARE.typeLine.length > 1) {
  3664.                                             showSelector = true;
  3665.                                         }
  3666.                                     }
  3667.                                 }
  3668.                                 if (app.helper.isMobileDb(CONF.MIDDLE_WARE.current_db)) {
  3669.                                     customSelector = false;
  3670.                                     showSelector = false;
  3671.                                 }
  3672.                                 return _.template(HEADER_TEMPLATE)(_.extend(this.getTemplateData(), {
  3673.                                     show_tabs: customSelector,
  3674.                                     showSelector: showSelector,
  3675.                                     selectedTypeLine: this.selectedTypeLine,
  3676.                                     selectedVsTypeLine: this.selectedVsTypeLine,
  3677.                                     selectedTypeDate: this.selectedTypeDate
  3678.                                 }));
  3679.                             }
  3680.                         }
  3681.                     };
  3682.                     if (reportConfig) {
  3683.                         app.deepExtend(this.reportConfig, reportConfig);
  3684.                     }
  3685.                     return this.render();
  3686.                 },
  3687.                 render: function() {
  3688.                     var CONF = this.CONF
  3689.                       , _this = this;
  3690.                     return new (app.ReportChart.extend({
  3691.                         initialize: function() {
  3692.                             this.selectedTypeLine = (typeof $("#typeLine", this.el).val() === "undefined" ? CONF.MIDDLE_WARE.selectedTypeLine : $("#typeLine", this.el).val());
  3693.                             this.selectedVsTypeLine = (typeof $("#vsTypeLine", this.el).val() === "undefined" ? CONF.MIDDLE_WARE.selectedVsTypeLine : $("#vsTypeLine", this.el).val());
  3694.                             this.selectedTypeDate = (typeof $("#typeDate a.pressed", this.el).attr("data-value") === "undefined" ? CONF.MIDDLE_WARE.selectedTypeDate : $("#typeDate a.pressed", this.el).attr("data-value"));
  3695.                             app.ReportChart.prototype.initialize.apply(this, arguments);
  3696.                         },
  3697.                         render: function() {
  3698.                             app.ReportChart.prototype.render.apply(this, arguments);
  3699.                             $('select', this.el).select2({
  3700.                                 minimumResultsForSearch: -1,
  3701.                                 width: "150px"
  3702.                             });
  3703.                         },
  3704.                         events: {
  3705.                             "change #typeLine": "_changePlot",
  3706.                             "click .typeLine a": "_changePlot",
  3707.                             "change #vsTypeLine": "_changePlot",
  3708.                             "click #typeDate a": "_changePlot",
  3709.                             "click .sem-widget-try-again": "tryAgainHandler"
  3710.                         },
  3711.                         _changePlot: function(e) {
  3712.                             if ($(e.target, this.el).is("#typeDate a")) {
  3713.                                 $("#typeDate a", this.el).removeClass("pressed");
  3714.                                 $(e.target, this.el).addClass("pressed");
  3715.                             }
  3716.                             if ($(e.target, this.el).is(".typeLine a")) {
  3717.                                 $(".typeLine a", this.el).removeClass("pressed");
  3718.                                 $(e.target, this.el).addClass("pressed");
  3719.                                 $("#typeLine", this.el).val($(e.target, this.el).attr("data-value"));
  3720.                             }
  3721.                             this.selectedTypeLine = CONF.MIDDLE_WARE.selectedTypeLine = $("#typeLine", this.el).val();
  3722.                             this.selectedVsTypeLine = CONF.MIDDLE_WARE.selectedVsTypeLine = $("#vsTypeLine", this.el).val();
  3723.                             this.selectedTypeDate = CONF.MIDDLE_WARE.selectedTypeDate = $("#typeDate a.pressed", this.el).attr("data-value");
  3724.                             cookiesUtils.setCookie('do-chart-date', this.selectedTypeDate, 365);
  3725.                             if (CONF.MIDDLE_WARE.selectedTypeDate == "30d")
  3726.                                 this.options.chartOptions.xAxis.minTickInterval = 4 * 24 * 3600 * 1000;
  3727.                             else
  3728.                                 this.options.chartOptions.xAxis.minTickInterval = 31 * 24 * 3600 * 1000;
  3729.                             if (CONF.MIDDLE_WARE.show_positions) {
  3730.                                 this.options.chartOptions.plotOptions.column.pointWidth = (CONF.MIDDLE_WARE.selectedTypeDate == "30d") ? 10 : (CONF.MIDDLE_WARE.selectedTypeDate == "all") ? 5 : (CONF.MIDDLE_WARE.selectedTypeDate == "6m") ? 23 : 10;
  3731.                             }
  3732.                             this.render();
  3733.                             this._updatePdf();
  3734.                         },
  3735.                         _updatePdf: function() {
  3736.                             var data = {
  3737.                                 chart_type: this.selectedTypeLine,
  3738.                                 period: this.selectedTypeDate
  3739.                             };
  3740.                             if (window.updatePdfParameters) {
  3741.                                 window.updatePdfParameters(data);
  3742.                             }
  3743.                         }
  3744.                     }))(this.reportConfig);
  3745.                 }
  3746.             });
  3747.         }
  3748.         .apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  3749.         __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  3750.     }
  3751.     , function(module, exports) {
  3752.         module.exports = "<p class=\"tooltip-title\"><%= title %></p>\n\n<% if (show_positions && _.first(data)) { %>\n\t<p><b><%= LOCALE.positions %>: <%= app.numberFormat((_.first(data)).total, 0, '.', ',') %></b></p>\n<% } %>\n\n<% if (data.length) { %>\n\t<table>\n\t\t<% _.each(data, function (item) { %>\n\t\t\t<tr>\n\t\t\t\t<td>\n\t\t\t\t\t<i class=\"tooltip-legend-icon\" style=\"background-color: <%= item.point.series.color %>\"></i>\n\t\t\t\t\t<%= item.point.series.name %>\n\t\t\t\t</td>\n\t\t\t\t<td><%= app.numberFormat(item.point.y, 0, \".\", \",\") %></td>\n\t\t\t</tr>\n\t\t<% }); %>\n\t</table>\n<% } %>"
  3753.     }
  3754.     , function(module, exports) {
  3755.         module.exports = "<%\n// show_tabs - show switcher between different widgets\n// selectedTypeLine - selected widget (Ot, Or, Ad)\n// showSelector - show select like 'organic vs paid' (probably used in old design)\n// selectedVsTypeLine - used in selector\n%>\n\n<% if (show_tabs) { %>\n\t<div class=\"sem-widget-footer-lb sem-widget-search-form typeLine\">\n\t\t<% _.each (MIDDLE_WARE.typeLine, function(type) {\n\t\t\tvar isSelected = (type == selectedTypeLine) ? 'pressed' : ''; %>\n\n\t\t\t<a href=\"javascript:void(0);\" data-value=\"<%= type %>\" class=\"sem-widget-search-form-advanced <%= isSelected %>\">\n\t\t\t\t<%= LOCALE[type] %>\n\t\t\t</a>\n\t\t<% }); %>\n\t</div>\n\t<input type=\"hidden\" value=\"<%= selectedTypeLine %>\" id=\"typeLine\" />\n<% } else { %>\n\t<%\n\t// show select like 'organic vs paid', probably used in old design\n\t// hidden select is used in shopping\n\t%>\n\t<div class=\"sem-widget-footer-lb\" style=\"margin-top: 5px; margin-left: 10px; <%= showSelector ? '' : 'display: none;' %>\">\n\t\t<select id=\"typeLine\" name=\"typeLine\">\n\t\t\t<% _.each (MIDDLE_WARE.typeLine, function(type) { %>\n\t\t\t\t<option value=\"<%= type %>\" <%= (type == selectedTypeLine) ? 'selected=\"selected\"' : '' %>>\n\t\t\t\t\t<%= LOCALE[type] %>\n\t\t\t\t</option>\n\t\t\t<% }); %>\n\t\t</select>\n\t\t<% if (typeof selectedVsTypeLine != \"undefined\") { %>\n\t\t\tvs\n\t\t\t<select id=\"vsTypeLine\" name=\"vsTypeLine\">\n\t\t\t\t<% _.each (MIDDLE_WARE.typeLine, function(type) { %>\n\t\t\t\t\t<option value=\"<%= type %>\" <%= (type == selectedVsTypeLine) ? 'selected=\"selected\"' : '' %>>\n\t\t\t\t\t\t<%= LOCALE[type] %>\n\t\t\t\t\t</option>\n\t\t\t\t<% }); %>\n\t\t\t</select>\n\t\t<% } %>\n\t</div>\n<% } %>\n\n<% if (LOCALE.title) { %>\n\t<h3 class=\"sem-widget-header-title\"><%= LOCALE.title %></h3>\n<% } %>\n\n<div class=\"sem-widget-footer-rb sem-widget-search-form\" id=\"typeDate\">\n\t<% _.each (MIDDLE_WARE.typeDate, function(type) {\n\t\tvar isSelected = (type == selectedTypeDate) ? 'pressed' : ''; %>\n\n\t\t<a href=\"javascript:void(0);\" data-value=\"<%= type %>\" class=\"sem-widget-search-form-advanced <%= isSelected %>\">\n\t\t\t<%= LOCALE[type] %>\n\t\t</a>\n\t<% }); %>\n</div>"
  3756.     }
  3757.     , , , , , , , , , , , , , , , , , , , , , , function(module, exports, __webpack_require__) {
  3758.         var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  3759.         !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(70), __webpack_require__(71), __webpack_require__(72), __webpack_require__(39), __webpack_require__(4), __webpack_require__(20), __webpack_require__(5)],
  3760.         __WEBPACK_AMD_DEFINE_RESULT__ = function(_, TR_TEMPLATE, TH_TEMPLATE, FOOTER_TEMPLATE, HEADER_TEMPLATE, Backbone) {
  3761.             "use strict";
  3762.             var getGaWidgetName = function(type) {
  3763.                 return 'Top ' + (type === 'organic' ? 'organic' : 'paid') + ' keywords';
  3764.             }
  3765.             var sendGa = function(type, label) {
  3766.                 if (typeof ga === 'undefined')
  3767.                     return;
  3768.                 ga('send', 'event', 'Domain overview', getGaWidgetName(type), label);
  3769.             }
  3770.             var gaClickOnTitle = function(type) {
  3771.                 sendGa(type, 'click to title')
  3772.             }
  3773.             var gaClickOnKeyword = function(type) {
  3774.                 sendGa(type, 'click to keyword')
  3775.             }
  3776.             var gaClickOnButton = function(type) {
  3777.                 sendGa(type, 'click to button')
  3778.             }
  3779.             return Backbone.View.extend({
  3780.                 initialize: function(options, reportConfig) {
  3781.                     var CONF = this.CONF = options;
  3782.                     this.reportConfig = {
  3783.                         el: $(CONF.EL),
  3784.                         title: CONF.LOCALE.title,
  3785.                         tooltip: CONF.LOCALE.title_tooltip,
  3786.                         title_href: app.conf.DB_PREFIX + app.conf.DB_DATE_PREFIX + "/info/" + CONF.MIDDLE_WARE.domain_id + "+(by+" + CONF.MIDDLE_WARE.type + ")",
  3787.                         MIDDLE_WARE: CONF.MIDDLE_WARE,
  3788.                         LOCALE: CONF.LOCALE,
  3789.                         fullReportLink: app.conf.DB_PREFIX + app.conf.DB_DATE_PREFIX + '/info/' + CONF.MIDDLE_WARE.domain_id + '+(by+' + CONF.MIDDLE_WARE.type + ')',
  3790.                         needToLogNothingFound: true,
  3791.                         gaLabel: getGaWidgetName(CONF.MIDDLE_WARE.type) + ' - Overview',
  3792.                         reports: [{
  3793.                             back: (function() {
  3794.                                 var foo = {
  3795.                                     key: app.conf.KEY,
  3796.                                     url: CONF.MIDDLE_WARE.backend_url,
  3797.                                     domain: CONF.MIDDLE_WARE.domain_id,
  3798.                                     action: "report",
  3799.                                     responceAction: "overview_" + CONF.MIDDLE_WARE.type,
  3800.                                     type: "domain_overview_" + CONF.MIDDLE_WARE.type,
  3801.                                     display_sort: "tr_desc"
  3802.                                 };
  3803.                                 if (CONF.MIDDLE_WARE.exportHash) {
  3804.                                     foo.display_hash = CONF.MIDDLE_WARE.exportHash;
  3805.                                 }
  3806.                                 if (CONF.MIDDLE_WARE.db_currency) {
  3807.                                     foo.currency = CONF.MIDDLE_WARE.db_currency;
  3808.                                 }
  3809.                                 if (CONF.MIDDLE_WARE.api_display_date && CONF.MIDDLE_WARE.api_display_date !== 'current') {
  3810.                                     foo.display_date = CONF.MIDDLE_WARE.api_display_date;
  3811.                                 }
  3812.                                 return foo;
  3813.                             }
  3814.                             )()
  3815.                         }],
  3816.                         overview: true,
  3817.                         templates: {
  3818.                             header: HEADER_TEMPLATE,
  3819.                             footer: FOOTER_TEMPLATE
  3820.                         },
  3821.                         labelClass: CONF.MIDDLE_WARE.labelClass,
  3822.                         labelText: CONF.MIDDLE_WARE.labelText,
  3823.                         table: {
  3824.                             itemsCount: 5,
  3825.                             header: function() {
  3826.                                 var foo = [];
  3827.                                 var trafficTitle = CONF.MIDDLE_WARE.is_new ? CONF.LOCALE.trafficPercent : CONF.LOCALE.traffic;
  3828.                                 foo.push({
  3829.                                     key: "Ph",
  3830.                                     title: CONF.LOCALE.keyphrase_title
  3831.                                 });
  3832.                                 foo.push({
  3833.                                     key: "Po",
  3834.                                     title: CONF.LOCALE.pos,
  3835.                                     className: "sem-report-block-table-col-40"
  3836.                                 });
  3837.                                 foo.push({
  3838.                                     key: "Nq",
  3839.                                     title: CONF.LOCALE.av_vol,
  3840.                                     className: "sem-report-block-table-col-80"
  3841.                                 });
  3842.                                 if (CONF.MIDDLE_WARE.current_db !== "bing-us") {
  3843.                                     foo.push({
  3844.                                         key: "Cp",
  3845.                                         title: CONF.LOCALE.cpc + ' (' + (CONF.MIDDLE_WARE.db_currency).toUpperCase() + ')',
  3846.                                         className: "sem-report-block-table-col-80"
  3847.                                     });
  3848.                                 }
  3849.                                 foo.push({
  3850.                                     key: 'Tr',
  3851.                                     title: trafficTitle,
  3852.                                     className: "sem-report-block-table-col-80"
  3853.                                 });
  3854.                                 return foo;
  3855.                             },
  3856.                             templates: {
  3857.                                 th: TH_TEMPLATE,
  3858.                                 tr: TR_TEMPLATE
  3859.                             }
  3860.                         }
  3861.                     };
  3862.                     if (reportConfig) {
  3863.                         app.deepExtend(this.reportConfig, reportConfig);
  3864.                     }
  3865.                     return this.render();
  3866.                 },
  3867.                 render: function() {
  3868.                     var CONF = this.CONF;
  3869.                     return new (app.ReportTable.extend({
  3870.                         nothingFoundEl: ".sem-widget-content",
  3871.                         events: {
  3872.                             'click .sem-widget-header-title a': function(e) {
  3873.                                 gaClickOnTitle(CONF.MIDDLE_WARE.type);
  3874.                             },
  3875.                             'click .sem-report-block-full-report': function(e) {
  3876.                                 gaClickOnButton(CONF.MIDDLE_WARE.type);
  3877.                             },
  3878.                             'click .cl-table-cell_keyword a': function(e) {
  3879.                                 gaClickOnKeyword(CONF.MIDDLE_WARE.type);
  3880.                             },
  3881.                             'click .sem-widget-try-again': 'tryAgainHandler'
  3882.                         },
  3883.                         afterRender: function() {
  3884.                             app.ReportTable.prototype.afterRender.apply(this, arguments);
  3885.                             $(CONF.EL + " tr").tipsy({
  3886.                                 title: "title",
  3887.                                 gravity: "w"
  3888.                             });
  3889.                         }
  3890.                     }))(this.reportConfig);
  3891.                 }
  3892.             });
  3893.         }
  3894.         .apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  3895.         __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  3896.     }
  3897.     , function(module, exports) {
  3898.         module.exports = "<% var isNew = MIDDLE_WARE.is_new; %>\n\n<% if (countTr < options.table.itemsCount) { %>\n\t<% if (isNew) { %>\n\t\t<tr>\n\t<% } else { %>\n\t\t<tr title=\"<%= LOCALE.traffic %> <%= item.get(\"Tr\") %>%\">\n\t<% } %>\n\t\t<%= helper.dispKw(item.get(\"Ph\"), 0) %>\n\t\t<%= helper.dispKwPos(item.get(\"Po\"), item.get(\"Pp\")) %>\n\t\t<td><%= helper.breakToThreeComa(item.get(\"Nq\")) %></td>\n\t\t<% if (MIDDLE_WARE.current_db !== \"bing-us\") { %>\n\t\t\t<%= helper.dispValue(item.get(\"Cp\")) %>\n\t\t<% } %>\n\n\t\t<% if (isNew) { %>\n\t\t\t<%= helper.dispValue(item.get(\"Tr\")) %>\n\t\t<% } else { %>\n\t\t\t<%= helper.dispTrBar(item.get(\"Tr\")) %>\n\t\t<% } %>\n\t</tr>\n<% } %>"
  3899.     }
  3900.     , function(module, exports) {
  3901.         module.exports = "<div class=\"sem-report-in-icon sem-report-in-icon-height\">\n\t<div class=\"sem-widget-col-titles\">\n\t\t<div class=\"sem-widget-title-text\">\n\t\t\t<%= helper.ucfirst(item.get(\"title\")) %>\n\t\t</div>\n\t</div>\n</div>"
  3902.     }
  3903.     , function(module, exports) {
  3904.         module.exports = "<% if (typeof options.fullReportLink !== \"undefined\") { %>\n<div class=\"sem-report-block-full-report\">\n\t<a href=\"<%= options.fullReportLink %>\"><%= LOCALE.full_report %></a>\n</div>\n<% } %>\n<% if (typeof options.exp !== \"undefined\") { %>\n<div class=\"sem-widget-footer-lb sem-widget-footer-export-links\"></div>\n<% } %>"
  3905.     }
  3906.     , , function(module, exports, __webpack_require__) {
  3907.         var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  3908.         !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(75), __webpack_require__(72), __webpack_require__(39), __webpack_require__(4), __webpack_require__(20), __webpack_require__(5)],
  3909.         __WEBPACK_AMD_DEFINE_RESULT__ = function(_, TR_TEMPLATE, FOOTER_TEMPLATE, HEADER_TEMPLATE, Backbone) {
  3910.             "use strict";
  3911.             var getGaWidgetName = function(type) {
  3912.                 return (type === 'organic_organic' ? 'Organic' : 'Paid') + ' competitor';
  3913.             }
  3914.             var gaClickOnTitle = function(type) {
  3915.                 sendGa(type, 'click to title');
  3916.             }
  3917.             var gaClickOnCompetitor = function(type) {
  3918.                 sendGa(type, 'click to competitor');
  3919.             }
  3920.             var gaClickOnComKeyword = function(type) {
  3921.                 sendGa(type, 'click to com. keywords');
  3922.             }
  3923.             var gaClickOnKeyword = function(type) {
  3924.                 sendGa(type, 'click to keywords');
  3925.             }
  3926.             var gaClickOnButton = function(type) {
  3927.                 sendGa(type, 'click to button');
  3928.             }
  3929.             var sendGa = function(type, label) {
  3930.                 var action = getGaWidgetName(type);
  3931.                 if (typeof ga !== 'undefined') {
  3932.                     ga('send', 'event', 'Domain overview', action, label);
  3933.                 }
  3934.             }
  3935.             return Backbone.View.extend({
  3936.                 initialize: function(options, reportConfig) {
  3937.                     var CONF = this.CONF = options;
  3938.                     this.reportConfig = {
  3939.                         el: $(CONF.EL),
  3940.                         title: CONF.LOCALE.title,
  3941.                         tooltip: CONF.LOCALE.title_tooltip,
  3942.                         title_href: app.conf.DB_PREFIX + app.conf.DB_DATE_PREFIX + "/info/" + CONF.MIDDLE_WARE.domain_id + "+(by+" + CONF.MIDDLE_WARE.type + ")",
  3943.                         MIDDLE_WARE: CONF.MIDDLE_WARE,
  3944.                         LOCALE: CONF.LOCALE,
  3945.                         fullReportLink: app.conf.DB_PREFIX + app.conf.DB_DATE_PREFIX + '/info/' + CONF.MIDDLE_WARE.domain_id + '+(by+' + CONF.MIDDLE_WARE.type + ')',
  3946.                         needToLogNothingFound: true,
  3947.                         gaLabel: getGaWidgetName(CONF.MIDDLE_WARE.type) + ' - Overview',
  3948.                         reports: [{
  3949.                             back: (function() {
  3950.                                 var foo = {
  3951.                                     key: app.conf.KEY,
  3952.                                     url: CONF.MIDDLE_WARE.backend_url,
  3953.                                     domain: CONF.MIDDLE_WARE.domain_id,
  3954.                                     action: "report",
  3955.                                     responceAction: "overview_" + CONF.MIDDLE_WARE.type,
  3956.                                     type: "domain_overview_" + CONF.MIDDLE_WARE.type,
  3957.                                     display_sort: "tr_desc"
  3958.                                 };
  3959.                                 if (CONF.MIDDLE_WARE.exportHash) {
  3960.                                     foo.display_hash = CONF.MIDDLE_WARE.exportHash;
  3961.                                 }
  3962.                                 if (CONF.MIDDLE_WARE.api_display_date && CONF.MIDDLE_WARE.api_display_date !== 'current') {
  3963.                                     foo.display_date = CONF.MIDDLE_WARE.api_display_date;
  3964.                                 }
  3965.                                 return foo;
  3966.                             }
  3967.                             )()
  3968.                         }],
  3969.                         overview: true,
  3970.                         templates: {
  3971.                             header: HEADER_TEMPLATE,
  3972.                             footer: FOOTER_TEMPLATE
  3973.                         },
  3974.                         labelClass: CONF.MIDDLE_WARE.labelClass,
  3975.                         labelText: CONF.MIDDLE_WARE.labelText,
  3976.                         table: {
  3977.                             itemsCount: 5,
  3978.                             header: function() {
  3979.                                 var foo = [];
  3980.                                 foo.push({
  3981.                                     key: "Dn",
  3982.                                     title: CONF.LOCALE.domain
  3983.                                 });
  3984.                                 foo.push({
  3985.                                     key: "Cr",
  3986.                                     title: CONF.LOCALE.competitor_relevance,
  3987.                                     className: "sem-report-block-table-col-100"
  3988.                                 });
  3989.                                 foo.push({
  3990.                                     key: "Np",
  3991.                                     title: CONF.LOCALE.common_keywords,
  3992.                                     className: "sem-report-block-table-col-100"
  3993.                                 });
  3994.                                 foo.push({
  3995.                                     key: "Or",
  3996.                                     title: CONF.LOCALE.keywords,
  3997.                                     className: "sem-report-block-table-col-80"
  3998.                                 });
  3999.                                 return foo;
  4000.                             },
  4001.                             templates: {
  4002.                                 tr: TR_TEMPLATE
  4003.                             }
  4004.                         }
  4005.                     };
  4006.                     if (reportConfig) {
  4007.                         app.deepExtend(this.reportConfig, reportConfig);
  4008.                     }
  4009.                     return this.render();
  4010.                 },
  4011.                 render: function() {
  4012.                     var CONF = this.CONF;
  4013.                     return new (app.ReportTable.extend({
  4014.                         nothingFoundEl: ".sem-widget-content",
  4015.                         afterRender: function() {
  4016.                             app.ReportTable.prototype.afterRender.apply(this, arguments);
  4017.                             $(CONF.EL + " tr").tipsy({
  4018.                                 title: "title",
  4019.                                 gravity: "w"
  4020.                             });
  4021.                         },
  4022.                         events: {
  4023.                             'click .sem-widget-header-title a': function(e) {
  4024.                                 gaClickOnTitle(CONF.MIDDLE_WARE.type);
  4025.                             },
  4026.                             'click .sem-widget-table-first-col a': function(e) {
  4027.                                 gaClickOnCompetitor(CONF.MIDDLE_WARE.type);
  4028.                             },
  4029.                             'click .cl-display-com-keyword a': function(e) {
  4030.                                 gaClickOnComKeyword(CONF.MIDDLE_WARE.type);
  4031.                             },
  4032.                             'click .cl-display-keyword a': function(e) {
  4033.                                 gaClickOnKeyword(CONF.MIDDLE_WARE.type);
  4034.                             },
  4035.                             'click .sem-report-block-full-report': function(e) {
  4036.                                 gaClickOnButton(CONF.MIDDLE_WARE.type);
  4037.                             },
  4038.                             'click .sem-widget-try-again': 'tryAgainHandler'
  4039.                         }
  4040.                     }))(this.reportConfig);
  4041.                 }
  4042.             });
  4043.         }
  4044.         .apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  4045.         __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  4046.     }
  4047.     , function(module, exports) {
  4048.         module.exports = "<% var compRel = helper.getCompRelevance(item.get(\"Cr\"), 1);\nvar keywordsField = (MIDDLE_WARE.type == \"organic_organic\") ? 'Or' : 'Ad';\nvar reportType = (MIDDLE_WARE.type == \"organic_organic\") ? 'organic' : 'adwords';\nvar isNew = MIDDLE_WARE.is_new;\n%>\n\n<% if (countTr < options.table.itemsCount) { %>\n\t<% if (isNew) { %>\n\t\t<tr title=\"<%= LOCALE.competitor_relevance + ' ' + item.get('Cr') %>%\">\n\t<% } else { %>\n\t\t<tr title=\"<%= LOCALE.competitor_relevance + ' ' + Math.round(compRel[0]) %>%\">\n\t<% } %>\t\n\t<%= helper.dispDom(item.get(\"Dn\"), item.get(\"As\"), 1) %>\n\t<%\n\t\tif (isNew) {\n\t%>\n\t\t<%= helper.dispCRNew(item.get(\"Dn\"), item.get(\"Cr\"), 0, 1) %>\n\t<%\n\t\t} else {\n\t%>\t\n\t\t<%=\thelper.dispCR(item.get(\"Dn\"), item.get(\"Cr\"), 0, 1) %>\n\t<%\n\t\t}\n\t%>\n\t<%= helper.dispCKw(item.get(\"Dn\"), data.domain, item.get(\"Np\"), MIDDLE_WARE.type, null, '+|P0|Lt|21|+|P1|Lt|21') /* Common keywords */ %>\n\t\n\t<% if (parseInt(item.get(keywordsField), 10) > 0) { %>\n\t<%= helper.dispRoundNumWithA(item.get(keywordsField), app.conf.DB_PREFIX + app.conf.DB_DATE_PREFIX + \"/info/\" + item.get(\"Dn\") + \"+(by+\" + reportType + \")\", 'cl-display-keyword') %>\n\t<% } else { %>\n\t<%= helper.dispRoundNum(item.get(keywordsField), 'cl-display-keyword') %>\n\t<% } %>\n</tr>\n<% } %>\n"
  4049.     }
  4050.     , , , function(module, exports) {
  4051.         module.exports = "<div class=\"report-block-nothing-found\" style=\"display: block\">\n    <h4><%= LOCALE.nothing_found %></h4>\n</div>"
  4052.     }
  4053.     , , function(module, exports, __webpack_require__) {
  4054.         var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  4055.         !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(81), __webpack_require__(72), __webpack_require__(39), __webpack_require__(4)],
  4056.         __WEBPACK_AMD_DEFINE_RESULT__ = function(_, TR_TEMPLATE, FOOTER_TEMPLATE, HEADER_TEMPLATE, Backbone) {
  4057.             "use strict";
  4058.             var getGaWidgetName = function() {
  4059.                 return 'Top anchors'
  4060.             }
  4061.             var gaClickOnTitle = function() {
  4062.                 sendGa('click to title')
  4063.             }
  4064.             var gaClickOnButton = function() {
  4065.                 sendGa('click to button')
  4066.             }
  4067.             var gaClickOnExport = function() {
  4068.                 sendGa('click to export')
  4069.             }
  4070.             var sendGa = function(label) {
  4071.                 if (typeof ga === 'undefined')
  4072.                     return;
  4073.                 var action = getGaWidgetName();
  4074.                 ga('send', 'event', 'Domain overview', action, label);
  4075.             }
  4076.             return Backbone.View.extend({
  4077.                 initialize: function(options, reportConfig) {
  4078.                     var CONF = this.CONF = options;
  4079.                     this.reportConfig = {
  4080.                         el: $(CONF.EL),
  4081.                         title: CONF.LOCALE.table_title,
  4082.                         title_href: '/analytics/backlinks/anchors/' + encodeURIComponent(this.CONF.MIDDLE_WARE.target) + ':' + this.CONF.MIDDLE_WARE.target_type,
  4083.                         MIDDLE_WARE: CONF.MIDDLE_WARE,
  4084.                         LOCALE: CONF.LOCALE,
  4085.                         fullReportLink: '/analytics/backlinks/anchors/' + encodeURIComponent(this.CONF.MIDDLE_WARE.target) + ':' + this.CONF.MIDDLE_WARE.target_type,
  4086.                         needToLogNothingFound: true,
  4087.                         gaLabel: getGaWidgetName() + ' - Overview',
  4088.                         reports: [{
  4089.                             back: {
  4090.                                 key: app.conf.KEY,
  4091.                                 url: CONF.MIDDLE_WARE.backend_url,
  4092.                                 type: "backlinks_overview",
  4093.                                 method: "nojsonp",
  4094.                                 target: CONF.MIDDLE_WARE.target,
  4095.                                 target_type: CONF.MIDDLE_WARE.target_type,
  4096.                                 responceAction: "data",
  4097.                                 display_hash: CONF.MIDDLE_WARE.display_hash,
  4098.                                 export_columns: CONF.MIDDLE_WARE.export_columns
  4099.                             }
  4100.                         }],
  4101.                         overview: true,
  4102.                         table: {
  4103.                             header: (function() {
  4104.                                 var columns = [];
  4105.                                 columns.push({
  4106.                                     title: CONF.LOCALE.anchors_title
  4107.                                 }, {
  4108.                                     title: CONF.LOCALE.domains_title,
  4109.                                     className: 'sem-report-block-table-col-120'
  4110.                                 }, {
  4111.                                     title: CONF.LOCALE.backlinks_title,
  4112.                                     className: 'sem-report-block-table-col-120'
  4113.                                 });
  4114.                                 return columns;
  4115.                             }
  4116.                             )(),
  4117.                             templates: {
  4118.                                 tr: TR_TEMPLATE
  4119.                             }
  4120.                         },
  4121.                         templates: {
  4122.                             header: HEADER_TEMPLATE,
  4123.                             footer: FOOTER_TEMPLATE
  4124.                         },
  4125.                         exp: {
  4126.                             title: CONF.LOCALE["export"],
  4127.                             titlePrefix: CONF.LOCALE["export"],
  4128.                             link: CONF.MIDDLE_WARE.export_link,
  4129.                             limit: CONF.MIDDLE_WARE.limit
  4130.                         }
  4131.                     };
  4132.                     if (reportConfig) {
  4133.                         app.deepExtend(this.reportConfig, reportConfig);
  4134.                     }
  4135.                     return this.render();
  4136.                 },
  4137.                 render: function() {
  4138.                     return new (app.ReportTable.extend({
  4139.                         getData: function(backendReports) {
  4140.                             var backendModel = _.values(backendReports.attributes)[0]
  4141.                               , col = new Backbone.Collection()
  4142.                               , response = backendModel.responce;
  4143.                             if (typeof response !== "undefined" && response.attributes) {
  4144.                                 col.reset(response.attributes.anchors.data);
  4145.                             }
  4146.                             return col;
  4147.                         },
  4148.                         events: {
  4149.                             'click .sem-widget-header-title a': gaClickOnTitle,
  4150.                             'click .sem-report-block-full-report a': gaClickOnButton,
  4151.                             'click .sem-widget-export-link': gaClickOnExport,
  4152.                             'click .sem-widget-try-again': 'tryAgainHandler'
  4153.                         }
  4154.                     }))(this.reportConfig);
  4155.                 }
  4156.             })
  4157.         }
  4158.         .apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  4159.         __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  4160.     }
  4161.     , function(module, exports) {
  4162.         module.exports = "<tr>\n    <td data-test-domain-overview-top-anchors-item-anchor><%= helper.displayFormattedAnchor(helper.clipString4(item.attributes.anchor, 80), LOCALE.empty_anchor)%></td>\n\t<td data-test-domain-overview-top-anchors-item-domains-count><%= helper.breakToThreeComa(item.attributes.domains_num) %></td>\n\t<td data-test-domain-overview-top-anchors-item-backlinks-count><%= helper.breakToThreeComa(item.attributes.backlinks_num) %></td>\n</tr>\n"
  4163.     }
  4164.     , function(module, exports, __webpack_require__) {
  4165.         var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  4166.         !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(4), __webpack_require__(86), __webpack_require__(87), __webpack_require__(91), __webpack_require__(94), __webpack_require__(83), __webpack_require__(45), __webpack_require__(96), __webpack_require__(97), __webpack_require__(99), __webpack_require__(5)],
  4167.         __WEBPACK_AMD_DEFINE_RESULT__ = function(_, Backbone, FixedMenu, SummaryClassic, SummaryBacklinks, SummaryEngagementMetrics, SummaryAdsense, OverviewLineChart, KeywordsChart, Categories, DATABASE_TEMPLATE) {
  4168.             "use strict";
  4169.             return Backbone.View.extend({
  4170.                 widgets: [],
  4171.                 totals: [],
  4172.                 other_databases: [],
  4173.                 initialize: function(options, reportConfig) {
  4174.                     this.CONF = options;
  4175.                     this._initSummarySections();
  4176.                 },
  4177.                 _initSummarySections: function() {
  4178.                     if (this.CONF.MIDDLE_WARE.current_db_date === 'current' && this.CONF.WIDGETS.Categories.MIDDLE_WARE.is_available) {
  4179.                         new Categories(this.CONF.WIDGETS.Categories);
  4180.                     }
  4181.                     this.summaryOrganic = new SummaryClassic(this.CONF.WIDGETS.SummaryOrganic);
  4182.                     this.summaryOrganic.report.on('summary:setNothingFound', this._setNothingFound, this);
  4183.                     this.summaryAdwords = new SummaryClassic(this.CONF.WIDGETS.SummaryAdwords);
  4184.                     this.summaryAdwords.report.on('summary:setNothingFound', this._setNothingFound, this);
  4185.                     this.summaryBacklinks = new SummaryBacklinks(this.CONF.WIDGETS.SummaryBacklinks);
  4186.                     this.summaryBacklinks.report.on('summary:setNothingFound', this._setNothingFound, this);
  4187.                     this.summaryEngagementMetrics = new SummaryEngagementMetrics(this.CONF.WIDGETS.SummaryEngagementMetrics);
  4188.                     this.summaryAdsense = new SummaryAdsense(this.CONF.WIDGETS.SummaryAdsense);
  4189.                     this.summaryAdsense.report.on('summary:setNothingFound', this._setNothingFound, this);
  4190.                     this.overviewLineChart = new OverviewLineChart(this.CONF.WIDGETS.OverviewLineChart);
  4191.                     this.organicKeywordsChart = new KeywordsChart(this.CONF.WIDGETS.OrganicKeywordsChart);
  4192.                     this.adwordsKeywordsChart = new KeywordsChart(this.CONF.WIDGETS.AdwordsKeywordsChart);
  4193.                     this.summaryOrganic.report.on('summary:otherDatabases', this._otherDatabases, this);
  4194.                 },
  4195.                 _setNothingFound: function(type, value) {
  4196.                     this.widgets[type] = value;
  4197.                     this._checkNothingFound();
  4198.                 },
  4199.                 _otherDatabases: function(databases) {
  4200.                     this.other_databases = databases;
  4201.                 },
  4202.                 _checkNothingFound: function() {
  4203.                     if (this.widgets['organic'] === false && this.widgets['adwords'] === false && this.widgets['adsense'] === false) {
  4204.                         if (typeof ga !== 'undefined') {
  4205.                             ga('send', 'event', 'Nothing found', 'all - Overview');
  4206.                         }
  4207.                     }
  4208.                     if (typeof this.widgets['organic'] != 'undefined' && typeof this.widgets['adwords'] != 'undefined' && typeof this.widgets['backlinks'] != 'undefined' && typeof this.widgets['adsense'] != 'undefined') {
  4209.                         if (this.widgets['organic'] === false && this.widgets['adwords'] === false && this.widgets['backlinks'] === false && this.widgets['adsense'] === false) {
  4210.                             $('#organic, #adwords, #backlinks, #asns, #videoadvertising, .summary').remove();
  4211.                             $('.summary-not-found-block').show();
  4212.                             this.summaryOrganic.report.logNothingFound(true, 'All blocks');
  4213.                         } else {
  4214.                             FixedMenu.showMenuOnScroll();
  4215.                             if (this.widgets['organic'] === false && this.widgets['adwords'] === false) {
  4216.                                 if (this.widgets['backlinks'] === true || this.widgets['adsense'] === true) {
  4217.                                     $('#charts').remove();
  4218.                                 }
  4219.                                 this._checkOtherDatabases();
  4220.                             }
  4221.                             if (this.widgets['backlinks'] === false) {
  4222.                                 this.summaryOrganic.report.logNothingFound(true, 'Backlinks Block');
  4223.                             }
  4224.                             if (this.widgets['adsense'] === false) {
  4225.                                 this.summaryAdsense.report.logNothingFound(true, 'Adsense Blocks');
  4226.                             }
  4227.                             if (this.widgets['organic'] === false) {
  4228.                                 this.summaryOrganic.report.logNothingFound(true, 'Organic Block');
  4229.                             }
  4230.                             if (this.widgets['adwords'] === false) {
  4231.                                 this.summaryAdwords.report.logNothingFound(true, 'Adwords Block');
  4232.                             }
  4233.                         }
  4234.                     }
  4235.                 },
  4236.                 _checkOtherDatabases: function() {
  4237.                     if (this.other_databases.length) {
  4238.                         var el = $('#databases');
  4239.                         el.html(_.template(DATABASE_TEMPLATE)({
  4240.                             databases: this.other_databases,
  4241.                             CONF: this.CONF
  4242.                         }));
  4243.                         $('.close-notification').click(function() {
  4244.                             el.hide();
  4245.                         });
  4246.                     }
  4247.                 }
  4248.             });
  4249.         }
  4250.         .apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  4251.         __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  4252.     }
  4253.     , function(module, exports, __webpack_require__) {
  4254.         var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  4255.         !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(84), __webpack_require__(85), __webpack_require__(4), __webpack_require__(5)],
  4256.         __WEBPACK_AMD_DEFINE_RESULT__ = function(_, CONTENT_TEMPLATE, FIXED_CONTENT_TEMPLATE, Backbone) {
  4257.             "use strict";
  4258.             var sendGaClickAds = function() {
  4259.                 sendClickGa('Ads');
  4260.             }
  4261.             var sendGaClickPublishers = function() {
  4262.                 sendClickGa('Publishers');
  4263.             }
  4264.             var sendGaClickAdvert = function() {
  4265.                 sendClickGa('Advertisers');
  4266.             }
  4267.             var sendClickGa = function(name) {
  4268.                 if (typeof ga === 'undefined')
  4269.                     return;
  4270.                 ga('send', 'event', 'Domain overview', 'Main metrics', 'click - Display advertising ' + name);
  4271.             }
  4272.             return Backbone.View.extend({
  4273.                 initialize: function(options, reportConfig) {
  4274.                     var conf = this.conf = options;
  4275.                     this.reportConfig = {
  4276.                         el: $(conf.EL),
  4277.                         MIDDLE_WARE: conf.MIDDLE_WARE,
  4278.                         LOCALE: conf.LOCALE,
  4279.                         reports: function() {
  4280.                             var backs = [{
  4281.                                 back: {
  4282.                                     key: app.conf.KEY,
  4283.                                     url: conf.MIDDLE_WARE.backend_url,
  4284.                                     domain: conf.MIDDLE_WARE.domain_id,
  4285.                                     type: "summary",
  4286.                                     adsCount: 0
  4287.                                 }
  4288.                             }];
  4289.                             return backs;
  4290.                         },
  4291.                         templates: {
  4292.                             header: "",
  4293.                             content: CONTENT_TEMPLATE,
  4294.                             widget: function() {
  4295.                                 var ret = "";
  4296.                                 ret += "<div class=\"sem-widget-content\">";
  4297.                                 ret += "<div class=\"sem-widget-loader\"></div>";
  4298.                                 ret += "</div>";
  4299.                                 if (this.noResults) {
  4300.                                     ret += this.template("noResults");
  4301.                                 } else if (this.serverError) {
  4302.                                     ret += this.template("serverError");
  4303.                                 } else {
  4304.                                     ret += this.template("content");
  4305.                                 }
  4306.                                 return ret;
  4307.                             }
  4308.                         },
  4309.                         table: {
  4310.                             header: [],
  4311.                             footer: ''
  4312.                         }
  4313.                     };
  4314.                     if (reportConfig) {
  4315.                         app.deepExtend(this.reportConfig, reportConfig);
  4316.                     }
  4317.                     app.deepExtend(this.options, this.reportConfig);
  4318.                     this.render();
  4319.                 },
  4320.                 render: function() {
  4321.                     var conf = this.conf;
  4322.                     this.report = new (app.ReportWidget.extend({
  4323.                         renderData: {
  4324.                             initialized: false
  4325.                         },
  4326.                         events: function() {
  4327.                             return _.extend({}, app.ReportWidget.prototype.events, {
  4328.                                 "click .cl-metric-ads": sendGaClickAds,
  4329.                                 "click .cl-metric-publishers": sendGaClickPublishers,
  4330.                                 "click .cl-metric-advert": sendGaClickAdvert
  4331.                             });
  4332.                         },
  4333.                         showLoader: function() {
  4334.                             app.ReportWidget.prototype.showLoader.apply(this, arguments);
  4335.                             $('.asns, #asns .sem-report-block-title').show();
  4336.                             if ($('#asns .sem-widget-content').length) {
  4337.                                 $('#asns .sem-widget-content .sem-widget-loader').show();
  4338.                             } else {
  4339.                                 $('#asns').prepend('<div class="sem-widget-content"><div class="sem-widget-loader" style="width: 100%; height: 150px;display: block;padding: 30px;margin-left: -30px;"></div></div>');
  4340.                                 this.addSpinner($('#asns .sem-widget-loader'));
  4341.                             }
  4342.                             $('#asns .sem-report-block-error').hide();
  4343.                         },
  4344.                         hideLoader: function(e) {
  4345.                             app.ReportWidget.prototype.hideLoader.apply(this, arguments);
  4346.                             $('#asns .sem-widget-loader').hide();
  4347.                             if (this.serverError !== false || this.noResults) {
  4348.                                 if (this.serverError === true) {
  4349.                                     $('#asns .sem-report-block-error').html(conf.LOCALE.error_message).show();
  4350.                                 } else {
  4351.                                     $('#asns .sem-report-block-error').html(conf.LOCALE.timeout_message).show();
  4352.                                 }
  4353.                                 $('.asns').hide();
  4354.                             }
  4355.                         },
  4356.                         getData: function(backendReports) {
  4357.                             var backendModel;
  4358.                             var result = {
  4359.                                 adsCount: 0,
  4360.                                 advertisersCount: 0,
  4361.                                 publishersCount: 0
  4362.                             };
  4363.                             _.each(backendReports.toJSON(), function(model) {
  4364.                                 if (model.loaded) {
  4365.                                     backendModel = model;
  4366.                                 }
  4367.                             });
  4368.                             if (backendModel) {
  4369.                                 var response = backendModel.responce;
  4370.                                 result.adsCount = response.get("adsCount");
  4371.                                 result.advertisersCount = response.get("advertisersCount");
  4372.                                 result.publishersCount = response.get("publishersCount");
  4373.                                 this.renderData.adsCount = response.get("adsCount");
  4374.                                 this.renderData.hasData = response.get("hasData");
  4375.                                 this.renderData.sharedData = response.get("rawData");
  4376.                                 this.renderData.initialized = true;
  4377.                             }
  4378.                             return new Backbone.Collection([result]);
  4379.                         },
  4380.                         render: function() {
  4381.                             app.ReportWidget.prototype.render.apply(this, arguments);
  4382.                             var sharedData = this.renderData.sharedData;
  4383.                             if (this.renderData.initialized) {
  4384.                                 $('.adsenseSummary').append(_.template(FIXED_CONTENT_TEMPLATE)(this.getTemplateData()));
  4385.                                 if (this.renderData.hasData) {
  4386.                                     requirejs(["page"], function(Page) {
  4387.                                         var latestOptions = {
  4388.                                             reports: [{
  4389.                                                 data: sharedData
  4390.                                             }],
  4391.                                             domainType: sharedData.latest.domainType
  4392.                                         };
  4393.                                         new Page.Publishers(conf.WIDGETS.Publishers,latestOptions);
  4394.                                         var landingOptions = {
  4395.                                             reports: [{
  4396.                                                 data: sharedData
  4397.                                             }],
  4398.                                             domainType: sharedData.landings.domainType
  4399.                                         };
  4400.                                         new Page.Landings(conf.WIDGETS.Landings,landingOptions);
  4401.                                         if (sharedData.text.total > 0) {
  4402.                                             var textOptions = {
  4403.                                                 reports: [{
  4404.                                                     data: sharedData
  4405.                                                 }],
  4406.                                                 domainType: sharedData.text.domainType
  4407.                                             };
  4408.                                             new Page.AdsenseAds(conf.WIDGETS.AdsenseTextAds,textOptions);
  4409.                                         }
  4410.                                         if (sharedData.media.total > 0) {
  4411.                                             var mediaOptions = {
  4412.                                                 reports: [{
  4413.                                                     data: sharedData
  4414.                                                 }],
  4415.                                                 domainType: sharedData.media.domainType
  4416.                                             };
  4417.                                             new Page.AdsenseAds(conf.WIDGETS.AdsenseMediaAds,mediaOptions);
  4418.                                         }
  4419.                                     });
  4420.                                     $('#asns .sem-report-block-nothing-found').hide();
  4421.                                     $('.asns').css('visibility', 'visible');
  4422.                                     $('.asns').show();
  4423.                                     this.trigger('summary:setNothingFound', 'adsense', true);
  4424.                                 } else {
  4425.                                     $('.asns').hide();
  4426.                                     $('#asns .sem-report-block-nothing-found').show();
  4427.                                     this.trigger('summary:setNothingFound', 'adsense', false);
  4428.                                 }
  4429.                                 $('#asns .sem-widget-loader').hide();
  4430.                             }
  4431.                         }
  4432.                     }))(this.reportConfig);
  4433.                 }
  4434.             });
  4435.         }
  4436.         .apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  4437.         __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  4438.     }
  4439.     , function(module, exports) {
  4440.         module.exports = "<% if (typeof data !== \"undefined\" && data.length) {\nvar model = data.first();\n%>\n<h4 class=\"sem-report-with-tooltip sem-report-block-title-td\" data-id=\"asns\">\n\t<span class=\"sem-report-block-type-circle sem-report-block-type-circle-3\"></span>\n\t<%= LOCALE.summary_title %>\n\t<div class=\"sem-report-tooltip-left\"><%= LOCALE.adsense_tooltip %></div>\n</h4>\n<div class=\"sem-report-block-row\">\n\t<div class=\"sem-report-block-row-td minimized\">\n\t\t<a class=\"cl-metric-ads s-report__counter\" href=\"/analytics/da/overview/<%= encodeURIComponent(MIDDLE_WARE.domain_id) %>\">\n\t\t\t<%= helper.roundNumRank(model.get(\"adsCount\")) %>\n\t\t</a>\n\t</div>\n\t<div class=\"sem-report-block-row-td sem-report-counter-title\"><%= LOCALE.ads_total_num_of_ads %></div>\n</div>\n\n<table class=\"sem-report-block-summary-table\">\n\t<tr>\n\t\t<td><%= LOCALE.ads_publishers_count_title %></td>\n\t\t<td class=\"right\">\n\t\t\t<% if (model.get(\"publishersCount\") > 0) { %>\n\t\t\t<a class=\"cl-metric-publishers\" href=\"/analytics/da/publishers/<%= encodeURIComponent(MIDDLE_WARE.domain_id) %>\">\n\t\t\t\t<%= helper.roundNumRank(model.get(\"publishersCount\")) %>\n\t\t\t</a>\n\t\t\t<% } else { %>\n\t\t\t<span class=\"zero\">0</span>\n\t\t\t<% } %>\n\t\t</td>\n\t</tr>\n\t<tr>\n\t\t<td><%= LOCALE.ads_advertisers_count_title %></td>\n\t\t<td class=\"right\">\n\t\t\t<% if (model.get(\"advertisersCount\") > 0) { %>\n\t\t\t<a class=\"cl-metric-advert\" href=\"/analytics/da/advertisers/<%= encodeURIComponent(MIDDLE_WARE.domain_id) %>\">\n\t\t\t\t<%= helper.roundNumRank(model.get(\"advertisersCount\")) %>\n\t\t\t</a>\n\t\t\t<% } else { %>\n\t\t\t<span class=\"zero\">0</span>\n\t\t\t<% } %>\n\t\t</td>\n\t</tr>\n</table>\n<% } %>\n"
  4441.     }
  4442.     , function(module, exports) {
  4443.         module.exports = "<% if (typeof data !== \"undefined\" && data.length) {\nvar model = data.first();\n%>\n<div class=\"sem-report-with-tooltip\">\n\t<div class=\"sem-report-header-table\">\n\t\t<div class=\"sem-report-header-td-title\">\n\t\t\t<span class=\"sem-report-block-type-circle sem-report-block-type-circle-3\"></span>\n\t\t\t<%= LOCALE.adsense_title %>\n\t\t</div>\n\t\t<div class=\"sem-report-block-row\">\n\t\t\t<div class=\"sem-report-block-row-td minimized\">\n\t\t\t\t<%= helper.roundNumRankFormatted(model.get(\"adsCount\")) %>\n\t\t\t</div>\n\t\t\t<div class=\"sem-report-block-row-td sem-report-counter-title\"><%= LOCALE.ads_total_num_of_ads %></div>\n\t\t</div>\n\t</div>\n\t<div class=\"sem-report-tooltip-down\"><%= LOCALE.adsense_tooltip %></div>\n</div>\n<% } %>\n"
  4444.     }
  4445.     , function(module, exports, __webpack_require__) {
  4446.         var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  4447.         'use strict';
  4448.         !(__WEBPACK_AMD_DEFINE_ARRAY__ = [],
  4449.         __WEBPACK_AMD_DEFINE_RESULT__ = function() {
  4450.             var overviewBlockSelect = function(id) {
  4451.                 var current = $(".sem-report-header-td.active").attr("data-id");
  4452.                 var $id = $("#" + id);
  4453.                 if ($id.length) {
  4454.                     var destination = $id.offset().top - $(".sem-report-header").outerHeight();
  4455.                     if (typeof current === "undefined") {
  4456.                         destination += 13;
  4457.                     }
  4458.                     $('body, html').animate({
  4459.                         scrollTop: destination
  4460.                     });
  4461.                 }
  4462.             };
  4463.             return {
  4464.                 allowScrollToBlocks: function() {
  4465.                     $('.sem-report-block-title-td').click(function() {
  4466.                         overviewBlockSelect($(this).attr('data-id'));
  4467.                     });
  4468.                 },
  4469.                 showMenuOnScroll: function() {
  4470.                     var resizeHeader = function(el) {
  4471.                         var left = $(document).scrollLeft();
  4472.                         el.css({
  4473.                             width: ($(".sem-report").width() + 60)
  4474.                         });
  4475.                         var $sideMenu = $(".sem-sidemenu");
  4476.                         el.css({
  4477.                             left: ($sideMenu.length > 0) ? ($sideMenu.width() - left + 30) : ($(".js-left-menu").width() - left + 30)
  4478.                         });
  4479.                     };
  4480.                     var nav = $(".sem-report-header");
  4481.                     $(".sem-report-header-start").waypoint({
  4482.                         handler: function(event, direction) {
  4483.                             if (direction === 'down') {
  4484.                                 nav.addClass("fixed");
  4485.                                 resizeHeader(nav);
  4486.                             } else {
  4487.                                 nav.removeClass("fixed").css({
  4488.                                     left: 0
  4489.                                 })
  4490.                             }
  4491.                         },
  4492.                         offset: function() {
  4493.                             return nav.outerHeight();
  4494.                         }
  4495.                     });
  4496.                     $(".sem-o-footer-wrapper").waypoint({
  4497.                         handler: function(event, direction) {
  4498.                             if (direction === 'down') {
  4499.                                 nav.removeClass("fixed").css({
  4500.                                     left: 0
  4501.                                 })
  4502.                             } else {
  4503.                                 nav.addClass("fixed");
  4504.                                 resizeHeader(nav);
  4505.                             }
  4506.                         },
  4507.                         offset: function() {
  4508.                             return -1 * nav.outerHeight();
  4509.                         }
  4510.                     });
  4511.                     var sections = $(".sem-report-block:visible");
  4512.                     var navigation_links = $(".sem-report-header-td");
  4513.                     sections.waypoint({
  4514.                         handler: function(event, direction) {
  4515.                             var active_section;
  4516.                             active_section = $(this);
  4517.                             if (direction === "up")
  4518.                                 active_section = active_section.prev();
  4519.                             var active_link = $('.sem-report-header-td[data-id="' + active_section.attr("id") + '"]');
  4520.                             navigation_links.removeClass("active");
  4521.                             active_link.addClass("active");
  4522.                         },
  4523.                         offset: 175
  4524.                     });
  4525.                     navigation_links.click(function(event) {
  4526.                         overviewBlockSelect($(this).attr('data-id'));
  4527.                     });
  4528.                     this.allowScrollToBlocks();
  4529.                     $(window).resize(function() {
  4530.                         resizeHeader($(".sem-report-header.fixed"));
  4531.                     });
  4532.                     $(window).scroll(function() {
  4533.                         resizeHeader($(".sem-report-header.fixed"));
  4534.                     });
  4535.                 }
  4536.             }
  4537.         }
  4538.         .apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  4539.         __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  4540.     }
  4541.     , function(module, exports, __webpack_require__) {
  4542.         var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  4543.         !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(88), __webpack_require__(89), __webpack_require__(90), __webpack_require__(4), __webpack_require__(5)],
  4544.         __WEBPACK_AMD_DEFINE_RESULT__ = function(_, CONTENT_TEMPLATE, FIXED_CONTENT_TEMPLATE, NOTHING_FOUND_TEMPLATE, Backbone) {
  4545.             "use strict";
  4546.             var sendGaClickTraffic = function(type) {
  4547.                 sendClickGa(type, 'Traffic');
  4548.             };
  4549.             var sendGaClickCost = function(type) {
  4550.                 sendClickGa(type, 'Cost');
  4551.             };
  4552.             var sendGaClickRank = function(type) {
  4553.                 sendClickGa(type, 'Rank');
  4554.             };
  4555.             var sendGaClickKeywords = function(type) {
  4556.                 sendClickGa(type, 'Keywords');
  4557.             };
  4558.             var sendClickGa = function(type, name) {
  4559.                 if (typeof ga === 'undefined')
  4560.                     return;
  4561.                 var typeName = (type === 'organic' ? 'Organic' : 'Paid');
  4562.                 ga('send', 'event', 'Domain overview', 'Main metrics', 'click - ' + typeName + ' ' + name);
  4563.             };
  4564.             return Backbone.View.extend({
  4565.                 initialize: function(options, reportConfig) {
  4566.                     var CONF = this.CONF = options;
  4567.                     this.reportConfig = {
  4568.                         el: $(CONF.EL),
  4569.                         MIDDLE_WARE: CONF.MIDDLE_WARE,
  4570.                         LOCALE: CONF.LOCALE,
  4571.                         typeToLog: "domain_rank_history",
  4572.                         reports: function() {
  4573.                             var backs = [{
  4574.                                 back: {
  4575.                                     key: app.conf.KEY,
  4576.                                     url: CONF.MIDDLE_WARE.backend_url,
  4577.                                     domain: CONF.MIDDLE_WARE.domain_id,
  4578.                                     display_hash: CONF.MIDDLE_WARE.exportHash,
  4579.                                     currency: CONF.MIDDLE_WARE.db_currency,
  4580.                                     action: "report",
  4581.                                     type: "domain_rank",
  4582.                                     responceAction: "rank"
  4583.                                 }
  4584.                             }, {
  4585.                                 back: {
  4586.                                     key: app.conf.KEY,
  4587.                                     url: CONF.MIDDLE_WARE.backend_url,
  4588.                                     domain: CONF.MIDDLE_WARE.domain_id,
  4589.                                     display_hash: CONF.MIDDLE_WARE.exportHashH,
  4590.                                     currency: CONF.MIDDLE_WARE.db_currency,
  4591.                                     action: "report",
  4592.                                     type: "domain_rank_history",
  4593.                                     display_sort: 'dt_asc',
  4594.                                     responceAction: "rank_history"
  4595.                                 }
  4596.                             }, {
  4597.                                 back: {
  4598.                                     key: app.conf.KEY,
  4599.                                     url: CONF.MIDDLE_WARE.current_backend_url,
  4600.                                     domain: CONF.MIDDLE_WARE.domain_id,
  4601.                                     display_hash: CONF.MIDDLE_WARE.exportHashRanks,
  4602.                                     currency: CONF.MIDDLE_WARE.db_currency,
  4603.                                     action: "report",
  4604.                                     type: "domain_ranks",
  4605.                                     responceAction: "ranks"
  4606.                                 }
  4607.                             }];
  4608.                             if (CONF.MIDDLE_WARE.current_db_date !== 'current') {
  4609.                                 backs[2].back.display_date = CONF.MIDDLE_WARE.current_db_date + '15';
  4610.                             } else {
  4611.                                 backs.push({
  4612.                                     back: {
  4613.                                         key: app.conf.KEY,
  4614.                                         url: CONF.MIDDLE_WARE.backend_url,
  4615.                                         domain: CONF.MIDDLE_WARE.domain_id,
  4616.                                         display_hash: CONF.MIDDLE_WARE.exportHashH,
  4617.                                         currency: CONF.MIDDLE_WARE.db_currency,
  4618.                                         action: "report",
  4619.                                         type: "domain_rank_history",
  4620.                                         display_daily: 1,
  4621.                                         display_sort: 'dt_asc',
  4622.                                         responceAction: "rank_history"
  4623.                                     }
  4624.                                 });
  4625.                             }
  4626.                             if (CONF.MIDDLE_WARE.api_display_date && CONF.MIDDLE_WARE.api_display_date !== 'current') {
  4627.                                 backs = backs.map(function(back) {
  4628.                                     back.back.display_date = CONF.MIDDLE_WARE.api_display_date;
  4629.                                     return back;
  4630.                                 });
  4631.                             }
  4632.                             return backs;
  4633.                         },
  4634.                         templates: {
  4635.                             header: "",
  4636.                             content: CONTENT_TEMPLATE,
  4637.                             widget: function() {
  4638.                                 var ret = "";
  4639.                                 ret += "<div class=\"sem-widget-content\">";
  4640.                                 ret += "<div class=\"sem-widget-loader\"></div>";
  4641.                                 ret += "</div>";
  4642.                                 if (this.noResults) {
  4643.                                     ret += this.template("noResults");
  4644.                                 } else if (this.serverError) {
  4645.                                     ret += this.template("serverError");
  4646.                                 } else {
  4647.                                     ret += this.template("content");
  4648.                                 }
  4649.                                 return ret;
  4650.                             }
  4651.                         },
  4652.                         table: {
  4653.                             header: [],
  4654.                             footer: ''
  4655.                         }
  4656.                     };
  4657.                     if (reportConfig) {
  4658.                         app.deepExtend(this.reportConfig, reportConfig);
  4659.                     }
  4660.                     app.deepExtend(this.options, this.reportConfig);
  4661.                     this.render();
  4662.                 },
  4663.                 render: function() {
  4664.                     var CONF = this.CONF;
  4665.                     this.report = new (app.ReportWidget.extend({
  4666.                         totals: {
  4667.                             traffic: -1
  4668.                         },
  4669.                         showLoader: function() {
  4670.                             app.ReportWidget.prototype.showLoader.apply(this, arguments);
  4671.                             $('.' + this.options.MIDDLE_WARE.type + 'Top, .' + this.options.MIDDLE_WARE.type + 'Center,  .' + this.options.MIDDLE_WARE.type + 'Bottom, #' + this.options.MIDDLE_WARE.type + ' .sem-report-block-title').show();
  4672.                             if ($('#' + this.options.MIDDLE_WARE.type + ' .sem-widget-content').length) {
  4673.                                 $('#' + this.options.MIDDLE_WARE.type + ' .sem-widget-content .sem-widget-loader').show();
  4674.                             } else {
  4675.                                 $('#' + this.options.MIDDLE_WARE.type).prepend('<div class="sem-widget-content"><div class="sem-widget-loader" style="width: 100%; height: 300px;display: block;padding: 30px;margin-left: -30px;"></div></div>');
  4676.                                 this.addSpinner($('#' + this.options.MIDDLE_WARE.type + ' .sem-widget-loader'));
  4677.                             }
  4678.                             $('#' + this.options.MIDDLE_WARE.type + ' .sem-report-block-error').hide();
  4679.                         },
  4680.                         hideLoader: function(e) {
  4681.                             app.ReportWidget.prototype.hideLoader.apply(this, arguments);
  4682.                             $('#' + CONF.MIDDLE_WARE.type + ' .sem-widget-loader').hide();
  4683.                             if (this.serverError !== false || this.noResults) {
  4684.                                 if (this.serverError === true) {
  4685.                                     $('#' + this.CONF.MIDDLE_WARE.type + ' .sem-report-block-error').html(this.CONF.LOCALE.error_message).show();
  4686.                                 } else {
  4687.                                     $('#' + this.CONF.MIDDLE_WARE.type + ' .sem-report-block-error').html(this.CONF.LOCALE.timeout_message).show();
  4688.                                 }
  4689.                                 $('.' + this.CONF.MIDDLE_WARE.type + 'Top, .' + this.CONF.MIDDLE_WARE.type + 'Center,  .' + this.CONF.MIDDLE_WARE.type + 'Bottom').hide();
  4690.                             }
  4691.                         },
  4692.                         getData: function(backendReports) {
  4693.                             this.CONF = CONF;
  4694.                             var backendModel, backendModelH, backendModelHD, currentModel, models, lastMonth, col = new Backbone.Collection(), _this = this, trafficField, trafficPriceField, keywordsField, result = {
  4695.                                 traffic: 0,
  4696.                                 traffic_prev: 0,
  4697.                                 traffic_diff: 0,
  4698.                                 keywords: 0,
  4699.                                 keywords_prev: 0,
  4700.                                 keywords_diff: 0,
  4701.                                 traffic_price: 0,
  4702.                                 traffic_price_prev: 0,
  4703.                                 traffic_price_diff: 0,
  4704.                                 rank: 0
  4705.                             };
  4706.                             if (CONF.MIDDLE_WARE.type === "organic") {
  4707.                                 trafficField = "Ot";
  4708.                                 trafficPriceField = "Oc";
  4709.                                 keywordsField = "Or";
  4710.                             } else {
  4711.                                 trafficField = "At";
  4712.                                 trafficPriceField = "Ac";
  4713.                                 keywordsField = "Ad";
  4714.                             }
  4715.                             _.each(backendReports.toJSON(), function(model) {
  4716.                                 if (model.type === "domain_rank" && typeof model.responce.attributes !== "undefined") {
  4717.                                     backendModel = model;
  4718.                                     _this.totals.traffic = 0;
  4719.                                 } else if (model.type === "domain_rank_history" && typeof model.responce.attributes !== "undefined") {
  4720.                                     if (model.display_daily === 1) {
  4721.                                         backendModelHD = model;
  4722.                                     } else {
  4723.                                         backendModelH = model;
  4724.                                     }
  4725.                                 }
  4726.                             });
  4727.                             if (typeof backendModelH !== "undefined" && backendModelH.length) {
  4728.                                 models = _.values(backendModelH.first())[0].models;
  4729.                                 if (_this.CONF.MIDDLE_WARE.current_db_date == "current") {
  4730.                                     var getLastDailyPoint = function(backendModelHD) {
  4731.                                         if (typeof _.values(backendModelHD.first())[0] === 'undefined') {
  4732.                                             return null;
  4733.                                         }
  4734.                                         var dailyModels = _.values(backendModelHD.first())[0].models;
  4735.                                         return (_.last(dailyModels)).get('Dt');
  4736.                                     }
  4737.                                     var getLastDayOfPrMonth = function() {
  4738.                                         var date = new Date();
  4739.                                         date.setDate(0);
  4740.                                         return app.dateFormat('%Y%m%d', date);
  4741.                                     }
  4742.                                     var lastDailyDate = getLastDailyPoint(backendModelHD);
  4743.                                     if (lastDailyDate && getLastDayOfPrMonth() >= lastDailyDate && models.length > 1) {
  4744.                                         lastMonth = models[models.length - 1];
  4745.                                         var lastMonthDate = lastMonth.get('Dt');
  4746.                                         var lastMonthTs = new Date(Date.parse(lastMonthDate.replace(/^(\d{4})(\d{2})(\d{2})$/, "$1/$2/$3 12:00:00")));
  4747.                                         var lastDateTs = new Date(Date.parse(lastDailyDate.replace(/^(\d{4})(\d{2})(\d{2})$/, "$1/$2/$3 12:00:00")));
  4748.                                         if (lastMonthTs.getMonth() === lastDateTs.getMonth()) {
  4749.                                             lastMonth = models[models.length - 2];
  4750.                                         } else {
  4751.                                             lastMonth = models[models.length - 1];
  4752.                                         }
  4753.                                     } else {
  4754.                                         lastMonth = models[models.length - 1];
  4755.                                         var lastMonthDate = lastMonth.get('Dt');
  4756.                                     }
  4757.                                 } else {
  4758.                                     _.each(models, function(model) {
  4759.                                         if (model.get("Dt") < _this.CONF.MIDDLE_WARE.current_db_date) {
  4760.                                             lastMonth = model;
  4761.                                         }
  4762.                                     });
  4763.                                 }
  4764.                                 if (lastMonth) {
  4765.                                     result.traffic_prev = lastMonth.get(trafficField);
  4766.                                     result.traffic_price_prev = lastMonth.get(trafficPriceField);
  4767.                                     result.keywords_prev = lastMonth.get(keywordsField);
  4768.                                 }
  4769.                             }
  4770.                             if (typeof backendModel !== "undefined" && backendModel.length) {
  4771.                                 currentModel = undefined;
  4772.                                 if (backendModel.first()) {
  4773.                                     currentModel = backendModel.first();
  4774.                                     result.rank = currentModel.get("Rk");
  4775.                                     result.traffic = currentModel.get(trafficField);
  4776.                                     result.traffic_price = currentModel.get(trafficPriceField);
  4777.                                     result.keywords = currentModel.get(keywordsField);
  4778.                                     _this.totals.traffic = parseInt(currentModel.get(keywordsField));
  4779.                                 }
  4780.                             }
  4781.                             var calcDiff = function(current, previous) {
  4782.                                 current = current || 0;
  4783.                                 previous = previous || 0;
  4784.                                 var diff = current - previous;
  4785.                                 if (previous > 0) {
  4786.                                     diff = Math.round(100 * diff / previous);
  4787.                                 } else if (current > 0) {
  4788.                                     diff = 100;
  4789.                                 }
  4790.                                 return diff;
  4791.                             };
  4792.                             result.traffic_diff = calcDiff(result.traffic, result.traffic_prev);
  4793.                             result.traffic_price_diff = calcDiff(result.traffic_price, result.traffic_price_prev);
  4794.                             result.keywords_diff = calcDiff(result.keywords, result.keywords_prev);
  4795.                             col.push(result);
  4796.                             return col;
  4797.                         },
  4798.                         render: function() {
  4799.                             app.ReportWidget.prototype.render.apply(this, arguments);
  4800.                             if (this.totals.traffic != -1) {
  4801.                                 var CONF = this.CONF;
  4802.                                 $('.' + CONF.MIDDLE_WARE.type + 'Summary').html(_.template(FIXED_CONTENT_TEMPLATE)(this.getTemplateData()));
  4803.                                 if (CONF.MIDDLE_WARE.type == "organic") {
  4804.                                     if (this.totals.traffic > 0) {
  4805.                                         if (typeof CONF.WIDGETS != 'undefined') {
  4806.                                             requirejs(["page"], function(Page) {
  4807.                                                 new Page.Keywords(CONF.WIDGETS.OrganicKeywords);
  4808.                                                 new Page.KeywordsDistribution(CONF.WIDGETS.OrganicKeywordsDistribution);
  4809.                                                 new Page.Competitors(CONF.WIDGETS.OrganicCompetitors);
  4810.                                                 new Page.CompetitorsDistribution(CONF.WIDGETS.OrganicCompetitorsDistribution);
  4811.                                                 if (CONF.MIDDLE_WARE.current_db_date === 'current') {
  4812.                                                     new Page.BrandedTrafficSummary(CONF.WIDGETS.BrandedTrafficSummary);
  4813.                                                     new Page.BrandedTrafficChart(CONF.WIDGETS.BrandedTrafficChart);
  4814.                                                     new Page.BrandedTrafficTrend(CONF.WIDGETS.BrandedTrafficTrend);
  4815.                                                 }
  4816.                                             });
  4817.                                             $('.organicCenter').css('visibility', 'visible');
  4818.                                         }
  4819.                                     } else {
  4820.                                         $('.organicCenter').hide();
  4821.                                         $('#organic .sem-report-block-nothing-found').show();
  4822.                                         $('#' + CONF.MIDDLE_WARE.type + 'Summary').html(_.template(NOTHING_FOUND_TEMPLATE)(this.getTemplateData()));
  4823.                                         this._gaSuggestionShown();
  4824.                                     }
  4825.                                 } else {
  4826.                                     if (this.totals.traffic > 0) {
  4827.                                         requirejs(["page"], function(Page) {
  4828.                                             new Page.Keywords(CONF.WIDGETS.AdwordsKeywords);
  4829.                                             new Page.KeywordsDistribution(CONF.WIDGETS.AdwordsKeywordsDistribution);
  4830.                                             new Page.Competitors(CONF.WIDGETS.AdwordsCompetitors);
  4831.                                             new Page.CompetitorsDistribution(CONF.WIDGETS.AdwordsCompetitorsDistribution);
  4832.                                             new Page.Ads(CONF.WIDGETS.AdwordsAds);
  4833.                                         });
  4834.                                         $('.adwordsCenter').css('visibility', 'visible');
  4835.                                     } else {
  4836.                                         $('.adwordsCenter').hide();
  4837.                                         $('#adwords .sem-report-block-nothing-found').show();
  4838.                                     }
  4839.                                 }
  4840.                                 this.trigger('summary:setNothingFound', CONF.MIDDLE_WARE.type, (this.totals.traffic > 0));
  4841.                                 if (this.totals.traffic === 0) {
  4842.                                     this._checkOtherDatabases();
  4843.                                 }
  4844.                                 $('#' + CONF.MIDDLE_WARE.type + ' .sem-widget-loader').hide();
  4845.                             }
  4846.                         },
  4847.                         _checkOtherDatabases: function() {
  4848.                             var backendReports = this.backendReports, backendModel, other_databases = [], _this = this;
  4849.                             _.each(backendReports.toJSON(), function(model) {
  4850.                                 if (model.type === "domain_ranks" && typeof model.responce.attributes !== "undefined") {
  4851.                                     backendModel = model;
  4852.                                 }
  4853.                             });
  4854.                             if (typeof backendModel !== "undefined" && backendModel.length) {
  4855.                                 _.each(backendModel.models, function(model) {
  4856.                                     if (model.get("Db") != _this.CONF.MIDDLE_WARE.current_db) {
  4857.                                         other_databases.push({
  4858.                                             name: model.get("Db"),
  4859.                                             keywords: parseInt(model.get("Or"))
  4860.                                         });
  4861.                                     }
  4862.                                 });
  4863.                             }
  4864.                             other_databases = _.sortBy(other_databases, function(db) {
  4865.                                 return -1 * db.keywords;
  4866.                             });
  4867.                             this.trigger('summary:otherDatabases', _.map(other_databases, "name"), false);
  4868.                         },
  4869.                         events: function() {
  4870.                             return _.extend({}, app.ReportWidget.prototype.events, {
  4871.                                 "click .suggestion-box a": "_gaGotoTracking",
  4872.                                 "click .show-data-link": "toggleTrackingSuggestion",
  4873.                                 "click .cl-metric-traffic": function() {
  4874.                                     sendGaClickTraffic(this.CONF.MIDDLE_WARE.type);
  4875.                                 },
  4876.                                 "click .cl-metric-rank": function() {
  4877.                                     sendGaClickRank(this.CONF.MIDDLE_WARE.type);
  4878.                                 },
  4879.                                 "click .cl-metric-keywords": function() {
  4880.                                     sendGaClickKeywords(this.CONF.MIDDLE_WARE.type);
  4881.                                 },
  4882.                                 "click .cl-metric-cost": function() {
  4883.                                     sendGaClickCost(this.CONF.MIDDLE_WARE.type);
  4884.                                 }
  4885.                             });
  4886.                         },
  4887.                         toggleTrackingSuggestion: function(e) {
  4888.                             $(e.target).toggleClass('_opened');
  4889.                             var infoBlock = $(e.target).parent().find('.suggestion-box');
  4890.                             infoBlock.toggle();
  4891.                             this._gaExpandSuggestion();
  4892.                         },
  4893.                         _gaExpandSuggestion: function() {
  4894.                             if (typeof ga !== "undefined") {
  4895.                                 ga('send', 'event', 'Suggestion', 'Expand suggestion', 'Goto tracking');
  4896.                             }
  4897.                         },
  4898.                         _gaGotoTracking: function(e) {
  4899.                             if (typeof ga !== "undefined") {
  4900.                                 ga('send', 'event', 'Suggestion', 'Click on button', 'Goto tracking');
  4901.                             }
  4902.                         },
  4903.                         _gaSuggestionShown: function() {
  4904.                             if (typeof ga !== "undefined") {
  4905.                                 ga('send', 'event', 'Suggestion', 'Suggestion shown', 'Goto tracking');
  4906.                             }
  4907.                         }
  4908.                     }))(this.reportConfig);
  4909.                 }
  4910.             });
  4911.         }
  4912.         .apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  4913.         __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  4914.     }
  4915.     , function(module, exports) {
  4916.         module.exports = "<%\tif (typeof data !== \"undefined\" && data.length) {\n\t\tvar model = data.first(), sign, cssClass;\n%>\n\t<h4 class=\"sem-report-with-tooltip sem-report-block-title-td\" data-id=\"<%= MIDDLE_WARE.type %>\">\n\t\t<span class=\"sem-report-block-type-circle sem-report-block-type-circle-<%= MIDDLE_WARE.type === 'organic' ? '0' : '1' %>\"></span>\n\t\t<%= LOCALE.summary_title %>\n\t\t<div class=\"sem-report-tooltip-left\"><%= LOCALE.tooltip %></div>\n\t</h4>\n\t<%\tsign = model.get(\"traffic_diff\") > 0 ? \"+\" : \"\";\n\t\tcssClass = model.get(\"traffic_diff\") > 0 ? 'positive' : (model.get(\"traffic_diff\") == 0 ? \"\" : 'negative'); %>\n\t<div class=\"sem-report-block-row\">\n\t\t<div class=\"sem-report-block-row-td minimized\">\n\t\t\t<a class=\"s-report__counter cl-metric-traffic\" href=\"<%= app.conf.DB_PREFIX + app.conf.DB_DATE_PREFIX + '/info/' + MIDDLE_WARE.domain_id + '+(by+' + MIDDLE_WARE.type + ')' %>\">\n\t\t\t\t<%= helper.roundNumRank(model.get(\"traffic\")) %>\n\t\t\t</a>\n\t\t</div>\n\t\t<div class=\"sem-report-block-row-td minimized\">\n\t\t\t<div class=\"sem-report-header-td-diff <%= cssClass %>\"><%= sign + model.get(\"traffic_diff\") %>%</div>\n\t\t</div>\n\t\t<div class=\"sem-report-block-row-td sem-report-counter-title\"><%= LOCALE.traffic %></div>\n\t</div>\n\n\t<table class=\"sem-report-block-summary-table\">\n\t\t<% if (MIDDLE_WARE.type == 'organic') { %>\n\t\t<tr>\n\t\t\t<td><%= LOCALE.rank %></td>\n\t\t\t<td class=\"right\">\n\t\t\t\t<a class=\"cl-metric-rank\" href=\"<%= app.conf.DB_PREFIX + app.conf.DB_DATE_PREFIX + '/info/' + MIDDLE_WARE.domain_id + '+(by+' + MIDDLE_WARE.type + ')' %>\">\n\t\t\t\t\t<%= helper.roundNumRank(model.get(\"rank\")) %>\n\t\t\t\t</a>\n\t\t\t</td>\n\t\t\t<td class=\"right\"></td>\n\t\t</tr>\n\t\t<% } %>\n\t\t<tr>\n\t\t<%\tsign = model.get(\"keywords_diff\") > 0 ? \"+\" : \"\";\n\t\t\tcssClass = model.get(\"keywords_diff\") > 0 ? 'positive' : (model.get(\"keywords_diff\") == 0 ? \"\" : 'negative'); %>\n\t\t\t<td><%= LOCALE.keywords %></td>\n\t\t\t<td class=\"right\">\n\t\t\t\t<a class=\"cl-metric-keywords\" href=\"<%= app.conf.DB_PREFIX + app.conf.DB_DATE_PREFIX + '/info/' + MIDDLE_WARE.domain_id + '+(by+' + MIDDLE_WARE.type + ')' %>\">\n\t\t\t\t\t<%= helper.roundNumRank(model.get(\"keywords\")) %>\n\t\t\t\t</a>\n\t\t\t</td>\n\t\t\t<td class=\"right\">\n\t\t\t\t<div class=\"sem-report-header-td-diff <%= cssClass %>\"><%= sign + model.get(\"keywords_diff\") %>%</div>\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t<%\tsign = model.get(\"traffic_price_diff\") > 0 ? \"+\" : \"\";\n\t\t\tcssClass = model.get(\"traffic_price_diff\") > 0 ? 'positive' : (model.get(\"traffic_price_diff\") == 0 ? \"\" : 'negative'); %>\n\t\t\t<td><%= LOCALE.traffic_cost %></td>\n\t\t\t<td class=\"right\">\n\t\t\t\t<a class=\"cl-metric-cost\" href=\"<%= app.conf.DB_PREFIX + app.conf.DB_DATE_PREFIX + '/info/' + MIDDLE_WARE.domain_id + '+(by+' + MIDDLE_WARE.type + ')' %>\">\n\t\t\t\t\t<%= helper.formatPriceRoundNum(model.get(\"traffic_price\"), MIDDLE_WARE.db_currency) %>\n\t\t\t\t</a>\n\t\t\t</td>\n\t\t\t<td class=\"right\">\n\t\t\t\t<div class=\"sem-report-header-td-diff <%= cssClass %>\"><%= sign + model.get(\"traffic_price_diff\") %>%</div>\n\t\t\t</td>\n\t\t</tr>\n\t</table>\n<%\t} %>\n"
  4917.     }
  4918.     , function(module, exports) {
  4919.         module.exports = "<%\tif (typeof data !== \"undefined\" && data.length) {\n\t\tvar model = data.first(), sign, cssClass;\n%>\n\t<%\tsign = model.get(\"traffic_diff\") > 0 ? \"+\" : \"\";\n\t\tcssClass = model.get(\"traffic_diff\") > 0 ? 'positive' : (model.get(\"traffic_diff\") == 0 ? \"\" : 'negative'); %>\n\t\t<div class=\"sem-report-with-tooltip\">\n\t\t\t<div class=\"sem-report-header-table\">\n\t\t\t\t<div class=\"sem-report-header-td-title\">\n\t\t\t\t\t<span class=\"sem-report-block-type-circle sem-report-block-type-circle-<%= MIDDLE_WARE.type === 'organic' ? '0' : '1' %>\"></span>\n\t\t\t\t\t<%= LOCALE.title %>\n\t\t\t\t</div>\n\t\t\t\t<div class=\"sem-report-block-row\">\n\t\t\t\t\t<div class=\"sem-report-block-row-td minimized\">\n\t\t\t\t\t\t<%= helper.roundNumRankFormatted(model.get(\"traffic\")) %>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"sem-report-block-row-td minimized\">\n\t\t\t\t\t\t<div class=\"sem-report-header-td-diff <%= cssClass %>\"><%= sign + model.get(\"traffic_diff\") %>%</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"sem-report-block-row-td sem-report-counter-title\"><%= LOCALE.traffic %></div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div class=\"sem-report-tooltip-down\"><%= LOCALE.tooltip %></div>\n\t\t</div>\n\t\t\n<%\t} %>"
  4920.     }
  4921.     , function(module, exports) {
  4922.         module.exports = "<h4 class=\"sem-report-with-tooltip sem-report-block-title-td\" data-id=\"<%= MIDDLE_WARE.type %>\">\n\t<span class=\"sem-report-block-type-circle sem-report-block-type-circle-<%= MIDDLE_WARE.type === 'organic' ? '0' : '1' %>\"></span>\n\t<%= LOCALE.summary_title %>\n\t<div class=\"sem-report-tooltip-left\"><%= LOCALE.tooltip %></div>\n</h4>\n<div class=\"sem-report-nothing-found\">\n\t<p><%= LOCALE.nothing_found_title %></p>\n\t<a href=\"javascript: void(0)\" class=\"show-data-link\"><%= LOCALE.nothing_found_text %><i></i></a>\n\n\t<div class=\"suggestion-box\" style=\"display: none\">\n\t\t<p><%= LOCALE.nothing_found_tracking_text %></p>\n\t\t<a href=\"/projects\" class=\"s-btn -xs -success\">\n\t\t\t<span class=\"s-btn__text\">Go to Position Tracking</span>\n\t\t</a>\n\t\t<div class=\"sem-report-title-info sem-report-with-tooltip\">\n\t\t\t<div class=\"sem-report-title-info-description sem-report-tooltip-down\"><%= LOCALE.go_to_tracking_tooltip %></div>\n\t\t</div>\n\t</div>\n</div>\n"
  4923.     }
  4924.     , function(module, exports, __webpack_require__) {
  4925.         var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  4926.         !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(92), __webpack_require__(93), __webpack_require__(4), __webpack_require__(5)],
  4927.         __WEBPACK_AMD_DEFINE_RESULT__ = function(_, CONTENT_TEMPLATE, FIXED_CONTENT_TEMPLATE, Backbone) {
  4928.             "use strict";
  4929.             var sendGaClickBacklinks = function() {
  4930.                 sendClickGa('Backlinks');
  4931.             }
  4932.             var sendGaClickDomains = function() {
  4933.                 sendClickGa('Domains');
  4934.             }
  4935.             var sendGaClickIp = function() {
  4936.                 sendClickGa('Ips');
  4937.             }
  4938.             var sendClickGa = function(name) {
  4939.                 if (typeof ga === 'undefined')
  4940.                     return;
  4941.                 ga('send', 'event', 'Domain overview', 'Main metrics', 'click - Backlinks ' + name);
  4942.             }
  4943.             return Backbone.View.extend({
  4944.                 initialize: function(options, reportConfig) {
  4945.                     var CONF = this.CONF = options;
  4946.                     this.reportConfig = {
  4947.                         el: $(CONF.EL),
  4948.                         MIDDLE_WARE: CONF.MIDDLE_WARE,
  4949.                         LOCALE: CONF.LOCALE,
  4950.                         reports: function() {
  4951.                             var backs = [{
  4952.                                 back: {
  4953.                                     key: app.conf.KEY,
  4954.                                     url: CONF.MIDDLE_WARE.bl_backend_url,
  4955.                                     target: CONF.MIDDLE_WARE.link,
  4956.                                     type: "backlinks_overview",
  4957.                                     method: "nojsonp",
  4958.                                     target_type: CONF.MIDDLE_WARE.target_type,
  4959.                                     export_columns: CONF.MIDDLE_WARE.export_columns,
  4960.                                     responceAction: "data"
  4961.                                 }
  4962.                             }];
  4963.                             if (CONF.MIDDLE_WARE.exportHashB) {
  4964.                                 backs[0].back.display_hash = CONF.MIDDLE_WARE.exportHashB;
  4965.                             }
  4966.                             return backs;
  4967.                         },
  4968.                         templates: {
  4969.                             header: "",
  4970.                             content: CONTENT_TEMPLATE,
  4971.                             widget: function() {
  4972.                                 var ret = "";
  4973.                                 ret += "<div class=\"sem-widget-content\">";
  4974.                                 ret += "<div class=\"sem-widget-loader\"></div>";
  4975.                                 ret += "</div>";
  4976.                                 if (this.noResults) {
  4977.                                     ret += this.template("content");
  4978.                                 } else if (this.serverError) {
  4979.                                     ret += this.template("serverError");
  4980.                                 } else {
  4981.                                     ret += this.template("content");
  4982.                                 }
  4983.                                 return ret;
  4984.                             }
  4985.                         },
  4986.                         table: {
  4987.                             header: [],
  4988.                             footer: ''
  4989.                         }
  4990.                     };
  4991.                     if (reportConfig) {
  4992.                         app.deepExtend(this.reportConfig, reportConfig);
  4993.                     }
  4994.                     app.deepExtend(this.options, this.reportConfig);
  4995.                     this.render();
  4996.                 },
  4997.                 render: function() {
  4998.                     var CONF = this.CONF;
  4999.                     this.report = new (app.ReportWidget.extend({
  5000.                         totals: {
  5001.                             backlinks: -1
  5002.                         },
  5003.                         events: function() {
  5004.                             return _.extend({}, app.ReportWidget.prototype.events, {
  5005.                                 "click .cl-metric-backlinks": sendGaClickBacklinks,
  5006.                                 "click .cl-metric-domains": sendGaClickDomains,
  5007.                                 "click .cl-metric-ip": sendGaClickIp
  5008.                             });
  5009.                         },
  5010.                         showLoader: function() {
  5011.                             app.ReportWidget.prototype.showLoader.apply(this, arguments);
  5012.                             $('.backlinks, #backlinks .sem-report-block-title').show();
  5013.                             if ($('#backlinks .sem-widget-content').length) {
  5014.                                 $('#backlinks .sem-widget-content .sem-widget-loader').show();
  5015.                             } else {
  5016.                                 $('#backlinks').prepend('<div class="sem-widget-content"><div class="sem-widget-loader" style="width: 100%; height: 50px;display: block;padding: 30px;margin-left: -30px;"></div></div>');
  5017.                                 this.addSpinner($('#backlinks .sem-widget-loader'));
  5018.                             }
  5019.                             $('#backlinks .sem-report-block-error').hide();
  5020.                         },
  5021.                         hideLoader: function(e) {
  5022.                             app.ReportWidget.prototype.hideLoader.apply(this, arguments);
  5023.                             $('#backlinks .sem-widget-loader').hide();
  5024.                             if (this.serverError !== false || this.noResults) {
  5025.                                 if (this.serverError === true) {
  5026.                                     $('#backlinks .sem-report-block-error').html(this.CONF.LOCALE.error_message).show();
  5027.                                 } else {
  5028.                                     $('#backlinks .sem-report-block-error').html(this.CONF.LOCALE.timeout_message).show();
  5029.                                 }
  5030.                                 $('.backlinks').hide();
  5031.                             }
  5032.                         },
  5033.                         getData: function(backendReports) {
  5034.                             this.CONF = CONF;
  5035.                             var backendModelB, col = new Backbone.Collection(), _this = this, result = {
  5036.                                 backlinks: 0,
  5037.                                 ref_domains: 0,
  5038.                                 ref_ips: 0
  5039.                             };
  5040.                             _.each(backendReports.toJSON(), function(model) {
  5041.                                 if (model.type === "backlinks_overview" && typeof model.responce.attributes !== "undefined") {
  5042.                                     backendModelB = model;
  5043.                                     _this.totals.backlinks = 0;
  5044.                                     _this.totals.ref_domains = 0;
  5045.                                     _this.totals.ref_ips = 0;
  5046.                                 }
  5047.                             });
  5048.                             if (typeof backendModelB !== "undefined" && backendModelB.loaded) {
  5049.                                 this.totals.backlinks = backendModelB.responce.attributes.total;
  5050.                                 result.backlinks = backendModelB.responce.attributes.total;
  5051.                                 result.ref_domains = backendModelB.responce.attributes.domains;
  5052.                                 result.ref_ips = backendModelB.responce.attributes.ip;
  5053.                             }
  5054.                             col.push(result);
  5055.                             return col;
  5056.                         },
  5057.                         render: function() {
  5058.                             app.ReportWidget.prototype.render.apply(this, arguments);
  5059.                             if (this.totals.backlinks != -1) {
  5060.                                 var CONF = this.CONF;
  5061.                                 $('.backlinksSummary').append(_.template(FIXED_CONTENT_TEMPLATE)(this.getTemplateData()));
  5062.                                 if (this.totals.backlinks > 0) {
  5063.                                     requirejs(["page"], function(Page) {
  5064.                                         new Page.Follow(CONF.WIDGETS.Follow);
  5065.                                         new Page.BacklinksTypeChart(CONF.WIDGETS.BacklinksTypeChart);
  5066.                                         new Page.Backlinks(CONF.WIDGETS.Backlinks);
  5067.                                         new Page.BacklinksAnchors(CONF.WIDGETS.BacklinksAnchors);
  5068.                                         new Page.BacklinksDomains(CONF.WIDGETS.BacklinksDomains);
  5069.                                         new Page.BacklinksPages(CONF.WIDGETS.BacklinksPages);
  5070.                                     });
  5071.                                     $('.backlinks').css('visibility', 'visible');
  5072.                                     this.trigger('summary:setNothingFound', 'backlinks', true);
  5073.                                 } else {
  5074.                                     $('.backlinks').hide();
  5075.                                     $('#backlinks .sem-report-block-nothing-found').show();
  5076.                                     this.trigger('summary:setNothingFound', 'backlinks', false);
  5077.                                 }
  5078.                                 if (CONF.WIDGETS.BacklinksDistribution) {
  5079.                                     requirejs(["page"], function(Page) {
  5080.                                         new Page.BacklinksDistribution(CONF.WIDGETS.BacklinksDistribution);
  5081.                                     });
  5082.                                 }
  5083.                             }
  5084.                         }
  5085.                     }))(this.reportConfig);
  5086.                 }
  5087.             });
  5088.         }
  5089.         .apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  5090.         __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  5091.     }
  5092.     , function(module, exports) {
  5093.         module.exports = "<%\tif (typeof data !== \"undefined\" && data.length) {\n\t\tvar model = data.first();\n%>\n\t<h4 class=\"sem-report-with-tooltip sem-report-block-title-td\" data-id=\"backlinks\" data-test-domain-overview-widget-title>\n\t\t<span class=\"sem-report-block-type-circle sem-report-block-type-circle-2\"></span>\n\t\t<%= LOCALE.summary_title %>\n\t\t<div class=\"sem-report-tooltip-left\"><%= LOCALE.backlinks_tooltip %></div>\n\t</h4>\n\t<div class=\"sem-report-block-row\">\n\t\t<div class=\"sem-report-block-row-td minimized\">\n\t\t\t<a class=\"s-report__counter cl-metric-backlinks\" href=\"/analytics/backlinks/backlinks/<%= encodeURIComponent(MIDDLE_WARE.link) %>:<%= MIDDLE_WARE.target_type %>\" data-test-domain-overview-total-backlinks-count>\n\t\t\t\t<%= helper.roundNumRank(model.get(\"backlinks\")) %>\n\t\t\t</a>\n\t\t</div>\n\t\t<div class=\"sem-report-block-row-td sem-report-counter-title\"><%= LOCALE.total %></div>\n\t</div>\n\n\t<table class=\"sem-report-block-summary-table\">\n\t\t<tr>\n\t\t\t<td><%= LOCALE.ref_domains %></td>\n\t\t\t<td class=\"right\">\n\t\t\t\t<a class=\"cl-metric-domains\" href=\"/analytics/backlinks/refdomains/<%= encodeURIComponent(MIDDLE_WARE.link) %>:<%= MIDDLE_WARE.target_type %>\" data-test-domain-overview-refdomains-count>\n\t\t\t\t\t<%= helper.roundNumRank(model.get(\"ref_domains\")) %>\n\t\t\t\t</a>\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td><%= LOCALE.ref_ips %></td>\n\t\t\t<td class=\"right\">\n\t\t\t\t<a class=\"cl-metric-ip\" href=\"/analytics/backlinks/refips/<%= encodeURIComponent(MIDDLE_WARE.link) %>:<%= MIDDLE_WARE.target_type %>\" data-test-domain-overview-refips-count>\n\t\t\t\t\t<%= helper.roundNumRank(model.get(\"ref_ips\")) %>\n\t\t\t\t</a>\n\t\t\t</td>\n\t\t</tr>\n\t</table>\n<%\t} %>\n"
  5094.     }
  5095.     , function(module, exports) {
  5096.         module.exports = "<%\tif (typeof data !== \"undefined\" && data.length) {\n\t\tvar model = data.first();\n%>\n\t<div class=\"sem-report-with-tooltip\">\n\t\t<div class=\"sem-report-header-table\">\n\t\t\t<div class=\"sem-report-header-td-title\">\n\t\t\t\t<span class=\"sem-report-block-type-circle sem-report-block-type-circle-2\"></span>\n\t\t\t\t<%= LOCALE.backlinks_title %>\n\t\t\t</div>\n\t\t\t<div class=\"sem-report-block-row\">\n\t\t\t\t<div class=\"sem-report-block-row-td minimized\" data-test-domain-overview-ribbon-total-backlinks-count>\n\t\t\t\t\t<%= helper.roundNumRankFormatted(model.get(\"backlinks\")) %>\n\t\t\t\t</div>\n\t\t\t\t<div class=\"sem-report-block-row-td sem-report-counter-title\"><%= LOCALE.total %></div>\n\t\t\t</div>\n\t\t</div>\n\t\t<div class=\"sem-report-tooltip-down\"><%= LOCALE.backlinks_tooltip %></div>\n\t</div>\n<%\t} %>\n"
  5097.     }
  5098.     , function(module, exports, __webpack_require__) {
  5099.         var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  5100.         !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(95), __webpack_require__(4)],
  5101.         __WEBPACK_AMD_DEFINE_RESULT__ = function(_, CONTENT_TEMPLATE, Backbone) {
  5102.             "use strict";
  5103.             return Backbone.View.extend({
  5104.                 initialize(options, reportConfig) {
  5105.                     this.reportConfig = {
  5106.                         el: $(options.EL),
  5107.                         MIDDLE_WARE: options.MIDDLE_WARE,
  5108.                         LOCALE: options.LOCALE,
  5109.                         reports: [{
  5110.                             back: {
  5111.                                 url: options.MIDDLE_WARE.backend_url,
  5112.                                 method: "nojsonp",
  5113.                                 domain: options.MIDDLE_WARE.domain,
  5114.                                 responceAction: "data"
  5115.                             }
  5116.                         }],
  5117.                         templates: {
  5118.                             header: "",
  5119.                             content: CONTENT_TEMPLATE,
  5120.                             widget: function() {
  5121.                                 return this.template("content");
  5122.                             }
  5123.                         }
  5124.                     };
  5125.                     if (reportConfig) {
  5126.                         app.deepExtend(this.reportConfig, reportConfig);
  5127.                     }
  5128.                     return this.render();
  5129.                 },
  5130.                 render: function() {
  5131.                     this.report = new (app.ReportWidget.extend({
  5132.                         getData: function(backendReports) {
  5133.                             var report = _.values(backendReports.attributes)[0];
  5134.                             var model = _.get(report, 'responce');
  5135.                             if (report.loaded) {
  5136.                                 return model.toJSON();
  5137.                             }
  5138.                             return false;
  5139.                         },
  5140.                         render: function() {
  5141.                             const code = _.get(_.result(_.values(this.backendReports.toJSON())[0], 'responce.toJSON'), 'rawData.code');
  5142.                             if (code === 200) {
  5143.                                 app.ReportWidget.prototype.render.apply(this, arguments);
  5144.                             }
  5145.                         }
  5146.                     }))(this.reportConfig);
  5147.                 }
  5148.             })
  5149.         }
  5150.         .apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  5151.         __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
  5152.     }
  5153.     , function(module, exports) {
  5154.         module.exports = "<style>\n\t#ta-engagement-metrics {\n\t\tmin-height: 0;\n\t\tmargin: 8px -30px 0;\n\t\tbackground: #f5f5f5;\n\t\tborder-bottom: 1px solid #dae4e7;\n\t\tborder-top: 1px solid #dae4e7;\n\t}\n\n\t#ta-engagement-metrics .widget {\n\t\tpadding: 4px 0 24px;\n\t\tbox-sizing: border-box;\n\t\twidth: calc(100% - 30px);\n\t}\n\n\t#ta-engagement-metrics .widget-header {\n\t\tborder-bottom: 1px solid #b4b4b4;\n    width: calc(75% - 28px);\n\t\tmargin-left: 28px;\n\t\tpadding-bottom: 5px;\n\t\tbox-sizing: border-box;\n\t}\n\n\t#ta-engagement-metrics .widget-table {\n\t\twidth: 100%;\n\t}\n\n\t#ta-engagement-metrics .widget-table td {\n\t\tvertical-align: top;\n\t\twidth: 25%;\n\t\tpadding: 8px 0px 8px 27px;\n\t\ttext-align: left;\n\t}\n\n\t#ta-engagement-metrics .widget-table td:last-child {\n\t\tpadding-top: 0;\n\t\tpadding-bottom: 0;\n\t}\n\n\t#ta-engagement-metrics .widget-table td,\n\t#ta-engagement-metrics .widget-table td:hover {\n\t\tbox-shadow: none;\n\t\tborder-left: none;\n\t\tbackground: none;\n\t}\n\n\t#ta-engagement-metrics .widget-title {\n\t\tpadding-top: 12px;\n\t\tcursor: pointer;\n\t\tdisplay: inline-block;\n\t\tfont-size: 16px;\n\t\tfont-weight: 500;\n\t\tfont-family: Ubuntu, sans-serif;\n\t\ttext-transform: uppercase;\n\t\ttext-align: left;\n\t\tcolor: #333;\n\t}\n\n\t#ta-engagement-metrics .widget-title a {\n\t\ttext-decoration: none;\n\t\tcolor: #333;\n\t}\n\n\t#ta-engagement-metrics .widget-info {\n\t\tdisplay: inline-block;\n\t\tmargin-left: 20px;\n\t\tpadding-top: 12px;\n\t\tcursor: default;\n\t}\n\n\t#ta-engagement-metrics .widget-info-db {\n\t\tposition: relative;\n\t\tcolor: #757575;\n\t\tpadding-right: 13px;\n\t\tfont-size: 12px;\n\t\tdisplay: inline-block;\n\t}\n\n\t#ta-engagement-metrics .widget-info-db span {\n\t\tmargin-left: 4px;\n\t}\n\n\t#ta-engagement-metrics .widget-info-db svg {\n\t\tdisplay: inline-block;\n\t\tvertical-align: -2px;\n\t\tcolor: #a6b0b3;\n\t}\n\n\t#ta-engagement-metrics .widget-info-db:after {\n\t\tposition: absolute;\n\t\tcontent: \"\";\n\t\tdisplay: block;\n\t\twidth: 1px;\n\t\theight: 16px;\n\t\tbackground-color: #cccccc;\n\t\ttop: -1px;\n\t\tright: 0;\n\t}\n\n\t#ta-engagement-metrics .widget-info-date {\n\t\tmargin-left: 12px;\n\t\tcolor: #757575;\n\t\tfont-size: 12px;\n\t}\n\n\t#ta-engagement-metrics .button {\n\t\tdisplay: inline-block;\n\t\tmargin: 0 auto;\n\t\tpadding: 5px 8px;\n\n\t\tborder-radius: 3px;\n\t\tborder: solid 1px #a6b0b3;\n\t\tcolor: #666;\n\t\tbackground-color: rgba(166, 176, 179, 0.1);\n\t\ttext-decoration: none;\n\t}\n\n\t#ta-engagement-metrics .button:hover {\n\t\tbackground-color: hsla(194, 8%, 68%, .2);\n\t}\n\n\t#ta-engagement-metrics .button-container {\n\t\ttext-align: center;\n\t}\n\n\t#ta-engagement-metrics .cell-metric {\n\t\tdisplay: flex;\n\t\tline-height: 1.3;\n\t}\n\n\t#ta-engagement-metrics .cell-metric-title {\n\t\tmargin-right: auto;\n\t\tpadding-right: 1em;\n\t}\n\n\t#ta-engagement-metrics .cell-metric-value {\n\t\tmargin-right: 16px;\n\t\tcolor: #333;\n\t\ttext-decoration: none;\n\t}\n\n\t#ta-engagement-metrics .cell-metric-diff {\n\t\tcolor: #ccc;\n\t}\n\n\t#ta-engagement-metrics .cell-metric-diff.positive {\n\t\tcolor: #20aa00;\n\t}\n\n\t#ta-engagement-metrics .cell-metric-diff.negative {\n\t\tcolor: #dd0500;\n\t}\n</style>\n\n<div class=\"widget\" id=\"ta-engagement-metrics-content\">\n\t<div class=\"widget-header\">\n\t\t<h4 class=\"widget-title sem-report-with-tooltip\">\n\t\t\t<span class=\"sem-report-block-type-circle sem-report-block-type-circle-7\"></span>\n\t\t\t<a href=\"<%= '/analytics/traffic/overview/' + data.domain %>\" onclick=\"<%= helper.getGAEventDispatcher('Click widget title')%>\">\n\t\t\t\t<%= LOCALE.ta_engagement_title %>\n\t\t\t</a>\n\n\t\t\t<div class=\"sem-report-tooltip-left\">\n\t\t\t\t<%= LOCALE.ta_engagement_tooltip %>\n\t\t\t</div>\n\t\t</h4>\n\n\t\t<span class=\"widget-info sem-report-with-tooltip\">\n\t\t\t<span class=\"widget-info-db\">\n\t\t\t\t<svg fill=\"currentColor\" preserveAspectRatio=\"xMidYMid meet\" viewBox=\"0 0 12 12\" width=\"12\"\n\t\t\t\t\theight=\"12\" data-name=\"Globe\" data-group=\"xs\">\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M6 0c3.313 0 6 2.687 6 6 0 3.314-2.687 6-6 6-3.314 0-6-2.686-6-6 0-3.313 2.686-6 6-6zm1.86 10.633c1.837-.741 3.14-2.534 3.14-4.633 0-1.981-1.167-3.681-2.842-4.49-.59.204-.762 1.06-1.096 1.394-.254.254-.466.21-.778.21s-.751.067-.976.147c-.224.081-.408.402-.408.713 0 .311.097.663.215.781.117.117.215.368.215.556 0 .188-.131.343-.291.343-.16 0-.618-.249-1.02-.552-.401-.303-.815-.447-1.062-.552-.247-.104-.334-.277-.334-.618 0-.332-.283-.934-.471-1.086-.709.863-1.152 1.953-1.152 3.154 0 2.757 2.243 5 5 5 .273 0 .535-.038.797-.08.314-.87.955-2.84.396-3.044-.717-.262-.97-1.072-.957-1.77.014-.699.904-.754 1.084-.617.18.138.641.363 1.754.675 1.111.312.523 2.231-.324 2.866-.569.426-.799 1.161-.89 1.603z\"\n\t\t\t\t\t\tshape-rendering=\"geometricPresision\"></path>\n\t\t\t\t</svg>\n\t\t\t\t<span><%= LOCALE.ta_engagement_db_global %></span>\n\t\t\t</span><span class=\"widget-info-date\"><%= helper.formatDate(data.displayDate, 'MMM YYYY') %></span>\n\n\t\t\t<div class=\"sem-report-tooltip-left\">\n\t\t\t\t<%= LOCALE.ta_engagement_db_global_tooltip %>\n\t\t\t</div>\n\t\t</span>\n\t</div>\n\n\t<div class=\"widget-body\">\n\t\t<table class=\"widget-table\">\n\t\t\t<tr>\n\t\t\t\t<td>\n\t\t\t\t\t<span class=\"cell-metric\">\n\t\t\t\t\t\t<span class=\"cell-metric-title\">\n\t\t\t\t\t\t\t<%= LOCALE.ta_engagement_metric_ppv %>\n\t\t\t\t\t\t</span>\n\n\t\t\t\t\t\t<a href=\"<%= '/analytics/traffic/overview/' + data.domain %>\" class=\"cell-metric-value\" onclick=\"<%= helper.getGAEventDispatcher('Click Pages per visit')%>\">\n\t\t\t\t\t\t\t<%= helper.roundValue(data.totalPagesPerVisit) %>\n\t\t\t\t\t\t</a>\n\n\t\t\t\t\t\t<span class=\"<%= 'cell-metric-diff ' + helper.getDiffCssClass(data.totalPagesPerVisitDiff) %>\">\n\t\t\t\t\t\t\t<%= helper.getSign(data.totalPagesPerVisitDiff) + helper.convertToPercent(data.totalPagesPerVisitDiff) %>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</span>\n\t\t\t\t</td>\n\n\n\t\t\t\t<td>\n\t\t\t\t\t<span class=\"cell-metric\">\n\t\t\t\t\t\t<span class=\"cell-metric-title\">\n\t\t\t\t\t\t\t<%= LOCALE.ta_engagement_metric_avd %>\n\t\t\t\t\t\t</span>\n\n\t\t\t\t\t\t<a href=\"<%= '/analytics/traffic/overview/' + data.domain %>\" class=\"cell-metric-value\" onclick=\"<%= helper.getGAEventDispatcher('Click Avg. visit duration')%>\">\n\t\t\t\t\t\t\t<%= helper.formatTime(data.totalAvgVisitDuration) %>\n\t\t\t\t\t\t</a>\n\n\t\t\t\t\t\t<span class=\"<%= 'cell-metric-diff ' + helper.getDiffCssClass(data.totalAvgVisitDurationDiff) %>\">\n\t\t\t\t\t\t\t<%= helper.getSign(data.totalAvgVisitDurationDiff) + helper.convertToPercent(data.totalAvgVisitDurationDiff) %>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</span>\n\t\t\t\t</td>\n\n\n\t\t\t\t<td>\n\t\t\t\t\t<span class=\"cell-metric\">\n\t\t\t\t\t\t<span class=\"cell-metric-title\">\n\t\t\t\t\t\t\t<%= LOCALE.ta_engagement_metric_br %>\n\t\t\t\t\t\t</span>\n\n\t\t\t\t\t\t<a href=\"<%= '/analytics/traffic/overview/' + data.domain %>\" class=\"cell-metric-value\" onclick=\"<%= helper.getGAEventDispatcher('Click Bounce rate')%>\">\n\t\t\t\t\t\t\t<%= helper.convertToPercent(data.totalBounceRate) %>\n\t\t\t\t\t\t</a>\n\n\t\t\t\t\t\t<span class=\"<%= 'cell-metric-diff ' + helper.getDiffCssClass(data.totalBounceRateDiff, true) %>\">\n\t\t\t\t\t\t\t<%= helper.getSign(data.totalBounceRateDiff) + helper.convertToPercent(data.totalBounceRateDiff) %>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</span>\n\t\t\t\t</td>\n\n\t\t\t\t<td>\n\t\t\t\t\t<div class=\"button-container\">\n\t\t\t\t\t\t<a href=\"<%= '/analytics/traffic/overview/' + data.domain %>\" class=\"button\" onclick=\"<%= helper.getGAEventDispatcher('Click Show all metrics')%>\">\n\t\t\t\t\t\t\t<%= LOCALE.ta_engagement_cta %>\n\t\t\t\t\t\t</a>\n\t\t\t\t\t</div>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t</table>\n\t</div>\n</div>\n\n<script>\n\tvar widget = document.getElementById('ta-engagement-metrics-content');\n\tvar callback = _.debounce(function() {\n\t\tga('send', {\n\t\t\thitType: 'event',\n\t\t\teventCategory: 'Traffic Analytics',\n\t\t\teventAction: 'Engagement metrics widget',\n\t\t\teventLabel: 'Mouse over widget'\n\t\t});\n\t}, 1000);\n\n\twidget.addEventListener('mouseenter', callback);\n\twidget.addEventListener('mouseleave', function() {\n\t\tcallback.cancel();\n\t});\n</script>\n"
  5155.     }
  5156.     , function(module, exports, __webpack_require__) {
  5157.         var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  5158.         !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(39), __webpack_require__(78), __webpack_require__(4), __webpack_require__(5)],
  5159.         __WEBPACK_AMD_DEFINE_RESULT__ = function(_, HEADER_TEMPLATE, NOTHING_FOUND_TEMPLATE, Backbone) {
  5160.             "use strict";
  5161.             var getGaWidgetName = function(type) {
  5162.                 return (type === 'organic' ? 'Organic' : 'Paid') + ' Pie Сhart';
  5163.             }
  5164.             var gaClickOnPieChart = function(type, db) {
  5165.                 var label = 'click to piechart - ' + db;
  5166.                 if (typeof ga !== 'undefined') {
  5167.                     ga('send', 'event', 'Domain overview', getGaWidgetName(type), label);
  5168.                 }
  5169.             }
  5170.             return Backbone.View.extend({
  5171.                 initialize: function(options, reportConfig) {
  5172.                     var CONF = this.CONF = options;
  5173.                     CONF.LOW_VALUES_LIMIT = 2;
  5174.                     this.reportConfig = {
  5175.                         el: $(CONF.EL),
  5176.                         title: CONF.LOCALE.title,
  5177.                         tooltip: CONF.LOCALE.title_tooltip,
  5178.                         title_href: app.conf.DB_PREFIX + app.conf.DB_DATE_PREFIX + "/info/" + CONF.MIDDLE_WARE.domain_id + "+(by+" + CONF.MIDDLE_WARE.type + ")",
  5179.                         MIDDLE_WARE: CONF.MIDDLE_WARE,
  5180.                         LOCALE: CONF.LOCALE,
  5181.                         needToLogNothingFound: true,
  5182.                         reports: [{
  5183.                             back: (function() {
  5184.                                 var foo = {
  5185.                                     key: app.conf.KEY,
  5186.                                     domain: CONF.MIDDLE_WARE.domain_id,
  5187.                                     url: CONF.MIDDLE_WARE.backend_url,
  5188.                                     action: "report",
  5189.                                     type: "domain_ranks",
  5190.                                     responceAction: "rank"
  5191.                                 };
  5192.                                 if (CONF.MIDDLE_WARE.exportHash) {
  5193.                                     foo.display_hash = CONF.MIDDLE_WARE.exportHash;
  5194.                                 }
  5195.                                 if (CONF.MIDDLE_WARE.current_db_date != 'current') {
  5196.                                     foo.display_date = CONF.MIDDLE_WARE.current_db_date + '15';
  5197.                                 }
  5198.                                 if (CONF.MIDDLE_WARE.db_currency) {
  5199.                                     foo.currency = CONF.MIDDLE_WARE.db_currency;
  5200.                                 }
  5201.                                 return foo;
  5202.                             }
  5203.                             )()
  5204.                         }],
  5205.                         chartOptions: {
  5206.                             chart: {
  5207.                                 type: "pie",
  5208.                                 spacingTop: 0,
  5209.                                 spacingLeft: -80,
  5210.                                 spacingRight: 0,
  5211.                                 spacingBottom: 0,
  5212.                                 height: 145
  5213.                             },
  5214.                             series: [{
  5215.                                 size: '100%',
  5216.                                 innerSize: '70%'
  5217.                             }],
  5218.                             legend: {
  5219.                                 itemMarginBottom: 1,
  5220.                                 verticalAlign: "top",
  5221.                                 itemMarginTop: 3,
  5222.                                 borderWidth: 0,
  5223.                                 floating: true,
  5224.                                 padding: 0,
  5225.                                 layout: "vertical",
  5226.                                 align: "center",
  5227.                                 width: 40,
  5228.                                 symbolWidth: 12,
  5229.                                 symbolRadius: 2,
  5230.                                 symbolPadding: 5,
  5231.                                 y: 0,
  5232.                                 x: 110,
  5233.                                 itemStyle: {
  5234.                                     fontSize: 10,
  5235.                                     textTransform: "uppercase"
  5236.                                 },
  5237.                                 navigation: {
  5238.                                     inactiveColor: "#ccc",
  5239.                                     activeColor: "#3E576F",
  5240.                                     animation: true,
  5241.                                     arrowSize: 10,
  5242.                                     style: {
  5243.                                         fontWeight: "bold",
  5244.                                         fontSize: "10px",
  5245.                                         color: "#333"
  5246.                                     }
  5247.                                 }
  5248.                             },
  5249.                             plotOptions: {
  5250.                                 pie: {
  5251.                                     center: ['50%', '50%'],
  5252.                                     ignoreHiddenPoint: true,
  5253.                                     showInLegend: true,
  5254.                                     slicedOffset: 0,
  5255.                                     shadow: false,
  5256.                                     size: "100%",
  5257.                                     borderWidth: 0,
  5258.                                     dataLabels: {
  5259.                                         enabled: false
  5260.                                     },
  5261.                                     point: {
  5262.                                         events: {
  5263.                                             click: function(e) {
  5264.                                                 var sectionName = e.currentTarget.name;
  5265.                                                 if (sectionName != 'Other') {
  5266.                                                     gaClickOnPieChart(CONF.MIDDLE_WARE.type, sectionName);
  5267.                                                     window.location = "" + (sectionName == 'us' ? '' : '/' + sectionName) + app.conf.DB_DATE_PREFIX + "/info/" + CONF.MIDDLE_WARE.domain_id + "+(by+" + CONF.MIDDLE_WARE.type + ")";
  5268.                                                 }
  5269.                                             }
  5270.                                         }
  5271.                                     }
  5272.                                 }
  5273.                             },
  5274.                             tooltip: {
  5275.                                 formatter: function() {
  5276.                                     return this.key + ": " + this.percentage.toFixed(2) + "%";
  5277.                                 }
  5278.                             }
  5279.                         },
  5280.                         templates: {
  5281.                             header: HEADER_TEMPLATE
  5282.                         },
  5283.                         getData: function(backendReports) {
  5284.                             var ret = _.values(backendReports.toJSON());
  5285.                             var field = (CONF.MIDDLE_WARE.type == "organic" ? "Or" : "Ad");
  5286.                             var models = [];
  5287.                             if (typeof ret[0] != 'undefined') {
  5288.                                 ret = ret[0];
  5289.                                 if (CONF.MIDDLE_WARE.is_new_api) {
  5290.                                     if (typeof ret.responce != 'undefined' && typeof ret.responce.attributes != 'undefined' && ret.responce.attributes.rawData != 'undefined' && ret.responce.attributes.rawData.rank != 'undefined' && ret.responce.attributes.rawData.rank.data != 'undefined') {
  5291.                                         models = ret.responce.attributes.rawData.rank.data;
  5292.                                     }
  5293.                                 } else {
  5294.                                     if (typeof ret != 'undefined' && typeof ret.models != 'undefined') {
  5295.                                         models = ret.models;
  5296.                                     }
  5297.                                 }
  5298.                             }
  5299.                             if (CONF.MIDDLE_WARE.is_new_api) {
  5300.                                 var sum = _.reduce(models, function(memo, item) {
  5301.                                     if (typeof item !== "undefined" && typeof seDBdata[_.get(item, 'Db')] != 'undefined') {
  5302.                                         return memo + parseInt(_.get(item, field), 10);
  5303.                                     } else {
  5304.                                         return memo;
  5305.                                     }
  5306.                                 }, 0)
  5307.                                   , data = _.compact(_.map(models, function(item) {
  5308.                                     if (typeof item !== "undefined" && parseInt(_.get(item, field), 10) && typeof seDBdata[_.get(item, 'Db')] != 'undefined') {
  5309.                                         return [_.get(item, 'Db'), _.get(item, field) * 100 / sum];
  5310.                                     }
  5311.                                 }, this));
  5312.                             } else {
  5313.                                 var sum = _.reduce(models, function(memo, item) {
  5314.                                     if (typeof item !== "undefined" && typeof seDBdata[item.get('Db')] != 'undefined') {
  5315.                                         return memo + parseInt(item.get(field), 10);
  5316.                                     } else {
  5317.                                         return memo;
  5318.                                     }
  5319.                                 }, 0)
  5320.                                   , data = _.compact(_.map(models, function(item) {
  5321.                                     if (typeof item !== "undefined" && parseInt(item.get(field), 10) && typeof seDBdata[item.get('Db')] != 'undefined') {
  5322.                                         return [item.get('Db'), item.get(field) * 100 / sum];
  5323.                                     }
  5324.                                 }, this));
  5325.                             }
  5326.                             var merge = ["Other", 0];
  5327.                             if (data.length > 0) {
  5328.                                 if (CONF.MIDDLE_WARE.mergeLowValues) {
  5329.                                     _.each(data, function(item, key) {
  5330.                                         if (item[1] < CONF.LOW_VALUES_LIMIT) {
  5331.                                             merge[1] += item[1];
  5332.                                             data[key] = "";
  5333.                                         }
  5334.                                     }, this);
  5335.                                 }
  5336.                                 data = _.compact(data);
  5337.                                 data.sort(function(a, b) {
  5338.                                     if (a[1] < b[1]) {
  5339.                                         return 1;
  5340.                                     }
  5341.                                     if (a[1] > b[1]) {
  5342.                                         return -1;
  5343.                                     }
  5344.                                     return 0;
  5345.                                 });
  5346.                                 if (merge[1]) {
  5347.                                     data.push(merge);
  5348.                                 }
  5349.                                 data = [{
  5350.                                     data: data,
  5351.                                     type: "pie"
  5352.                                 }];
  5353.                             } else {
  5354.                                 this.el.html(_.template(NOTHING_FOUND_TEMPLATE)({
  5355.                                     LOCALE: this.LOCALE
  5356.                                 }));
  5357.                                 return [{}];
  5358.                             }
  5359.                             return data;
  5360.                         },
  5361.                         labelClass: CONF.MIDDLE_WARE.labelClass,
  5362.                         labelText: CONF.MIDDLE_WARE.labelText
  5363.                     };
  5364.                     if (reportConfig) {
  5365.                         app.deepExtend(this.reportConfig, reportConfig);
  5366.                     }
  5367.                     return this.render();
  5368.                 },
  5369.                 render: function() {
  5370.                     return new app.ReportChart(this.reportConfig);
  5371.                 }
  5372.             });
  5373.         }
  5374.         .apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  5375.         __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  5376.     }
  5377.     , function(module, exports, __webpack_require__) {
  5378.         var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  5379.         !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(98), __webpack_require__(4)],
  5380.         __WEBPACK_AMD_DEFINE_RESULT__ = function(_, CONTENT_TEMPLATE, Backbone) {
  5381.             "use strict";
  5382.             return Backbone.View.extend({
  5383.                 initialize: function(options, reportConfig) {
  5384.                     var CONF = this.CONF = options;
  5385.                     this.reportConfig = {
  5386.                         el: $(CONF.EL),
  5387.                         MIDDLE_WARE: CONF.MIDDLE_WARE,
  5388.                         LOCALE: CONF.LOCALE,
  5389.                         className: 'widget-categories',
  5390.                         reports: [{
  5391.                             back: (function() {
  5392.                                 var foo = {
  5393.                                     key: app.conf.KEY,
  5394.                                     url: CONF.MIDDLE_WARE.backend_url,
  5395.                                     type: CONF.MIDDLE_WARE.type,
  5396.                                     action: "report"
  5397.                                 };
  5398.                                 if (CONF.MIDDLE_WARE.type == "domain_rank") {
  5399.                                     foo.domain = CONF.MIDDLE_WARE.domain_id;
  5400.                                     foo.responceAction = "rank";
  5401.                                 } else {
  5402.                                     foo.phrase = CONF.MIDDLE_WARE.phrase;
  5403.                                     foo.responceAction = "this";
  5404.                                 }
  5405.                                 return foo;
  5406.                             }
  5407.                             )()
  5408.                         }],
  5409.                         templates: {
  5410.                             content: CONTENT_TEMPLATE,
  5411.                             widget: function() {
  5412.                                 var ret = "";
  5413.                                 if (!this.noResults && !this.serverError) {
  5414.                                     ret += this.template("content");
  5415.                                 }
  5416.                                 return ret;
  5417.                             }
  5418.                         },
  5419.                         getData: function(backendReports) {
  5420.                             var backendModel, result = {
  5421.                                 categories: []
  5422.                             };
  5423.                             _.each(backendReports.toJSON(), function(model) {
  5424.                                 backendModel = model;
  5425.                             });
  5426.                             if (typeof backendModel !== "undefined" && backendModel.length) {
  5427.                                 backendModel = backendModel.first();
  5428.                                 if (backendModel.get("Ca") && backendModel.get("Ca").length) {
  5429.                                     _.each(backendModel.get("Ca").split(","), function(value) {
  5430.                                         if (value) {
  5431.                                             result.categories.push({
  5432.                                                 id: parseInt(value)
  5433.                                             });
  5434.                                         }
  5435.                                     });
  5436.                                     result.categories = _.compact(result.categories);
  5437.                                     if (CONF.MIDDLE_WARE.type == "domain_rank") {
  5438.                                         var distribution = (backendModel.get("Dc") && backendModel.get("Dc").length) ? backendModel.get("Dc").split(",") : [];
  5439.                                         _.each(result.categories, function(model, i) {
  5440.                                             result.categories[i].ratio = (typeof distribution[i] == "undefined") ? 0 : parseInt(distribution[i]);
  5441.                                         });
  5442.                                     }
  5443.                                     if (CONF.MIDDLE_WARE.type == "domain_rank") {
  5444.                                         var sum = _.reduce(_.map(result.categories, 'ratio'), function(total, n) {
  5445.                                             return total + n;
  5446.                                         });
  5447.                                         result.other = {
  5448.                                             ratio: (sum < 100) ? 100 - sum : '< 1'
  5449.                                         };
  5450.                                     }
  5451.                                 }
  5452.                             }
  5453.                             return result;
  5454.                         }
  5455.                     };
  5456.                     this.render();
  5457.                 },
  5458.                 render: function() {
  5459.                     return new (app.ReportWidget.extend({
  5460.                         events: {
  5461.                             "click .report-title-categories-el": "categoryLineHandler",
  5462.                             "click .js-drop-category": "categoryDropdownHandler",
  5463.                             "hover .s-dropdown-btn": "openDetails"
  5464.                         },
  5465.                         categoryLineHandler: function(e) {
  5466.                             this.sendGa("Click on categories line");
  5467.                         },
  5468.                         categoryDropdownHandler: function(e) {
  5469.                             this.sendGa("Click on categories dropdown");
  5470.                         },
  5471.                         openDetails: function(e) {
  5472.                             this.sendGa("Open categories details");
  5473.                         },
  5474.                         sendGa: function(action) {
  5475.                             if (typeof ga !== "undefined") {
  5476.                                 ga("send", "event", "DomainCategories", action);
  5477.                             }
  5478.                         }
  5479.                     }))(this.reportConfig);
  5480.                 }
  5481.             })
  5482.         }
  5483.         .apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  5484.         __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  5485.     }
  5486.     , function(module, exports) {
  5487.         module.exports = "<% if (typeof data !== \"undefined\" && data.categories.length) {\n\tvar positionsHref = (MIDDLE_WARE.type == \"domain_rank\") ? app.conf.DB_PREFIX + app.conf.DB_DATE_PREFIX + \"/info/\" + MIDDLE_WARE.domain_id + \"+(by+organic)?filter=%2B|Ca|Eq|\" : \"\"; %>\n\n\t<div style=\"display: inline-block;\">\n\t\t<%= LOCALE.category %>:\n\t\t<% _.each(_.take(data.categories, 3), function(category) { %>\n\t\t\t<<%= (MIDDLE_WARE.type == \"domain_rank\") ? \"a\" : \"span\" %><%= (positionsHref) ? \" href=\\\"\" + positionsHref + category.id + \"\\\"\" : \"\" %> class=\"s-link report-title-categories-el\">\n\t\t\t\t<%= LOCALE[\"domain_Ca_\" + category.id] %></<%= (MIDDLE_WARE.type == \"domain_rank\") ? \"a\" : \"span\" %>>\n\t\t<% }); %>\n\n\t\t<% if (MIDDLE_WARE.type == \"domain_rank\") { %>\n\t\t\t<div class=\"s-dropdown-white\">\n\t\t\t\t<span class=\"s-dropdown-btn\">\n\t\t\t\t\t<%= LOCALE.show_ratio %>\n\t\t\t\t\t<span class=\"caret\"></span>\n\t\t\t\t</span>\n\t\t\t\t<ul class=\"s-dropdown-menu\">\n\t\t\t\t\t<% _.each(data.categories, function(category) { %>\n\t\t\t\t\t\t<li class=\"clearfix\">\n\t\t\t\t\t\t\t<span class=\"s-float -right\"><%= category.ratio %>%</span>\n\t\t\t\t\t\t\t<a class=\"js-drop-category s-link\" href=\"<%= positionsHref + category.id %>\"><%= LOCALE[\"domain_Ca_\" + category.id] %></a>\n\t\t\t\t\t\t</li>\n\t\t\t\t\t<% }) %>\n\t\t\t\t\t<% if (data.other) { %>\n\t\t\t\t\t<li class=\"clearfix\">\n\t\t\t\t\t\t<span class=\"s-float -right\"><%= data.other.ratio %>%</span>\n\t\t\t\t\t\t<%= LOCALE.other %>\n\t\t\t\t\t</li>\n\t\t\t\t\t<% } %>\n\t\t\t\t</ul>\n\t\t\t</div>\n\t\t<% } %>\n\t</div>\n<% } %>\n"
  5488.     }
  5489.     , function(module, exports) {
  5490.         module.exports = "<div class=\"sem-report-database-suggestions\">\n\t<% if (databases[0]) { %>\n\t<%= CONF.LOCALE.other_databases %> <a href=\"<%= (databases[0] === 'us') ? '' : '/' + databases[0] %><%= CONF.MIDDLE_WARE.date_prefix %>/info/<%= CONF.MIDDLE_WARE.domain_id %>\"><span><%= databases[0] %></span> <%= CONF.MIDDLE_WARE['database_list'][databases[0]]['sel'] %></a>\n\t<% } %>\n\t<% if (databases.length > 1) { %>\n\t\tand\n\t\t<% if (databases.length > 2) { %>\n\n\t\t\t<div class=\"database-select\">\n\t\t\t\t<div class=\"database-select-text\"><span><%= databases.length - 1 %> more</span><i></i></div>\n\t\t\t\t<ul class=\"database-dropdown\">\n\t\t\t\t\t<% for (var i = 1, length = databases.length; i < length; i++) { %>\n\t\t\t\t\t\t<li class=\"database-dropdown-item\">\n\t\t\t\t\t\t\t<a class=\"sa-tool-settings-dropdown-link\" href=\"<%= (databases[i] === 'us') ? '' : '/' + databases[i] %><%= CONF.MIDDLE_WARE.date_prefix %>/info/<%= CONF.MIDDLE_WARE.domain_id %>\"><span><%= databases[i] %></span> <%= CONF.MIDDLE_WARE['database_list'][databases[i]]['sel'] %></a>\n\t\t\t\t\t\t</li>\n\t\t\t\t\t<% } %>\n\t\t\t\t</ul>\n\t\t\t</div>\n\n\t\t<% } else { %>\n\t\t\t<a href=\"<%= (databases[1] === 'us') ? '' : '/' + databases[1] %><%= CONF.MIDDLE_WARE.date_prefix %>/info/<%= CONF.MIDDLE_WARE.domain_id %>\"><span><%= databases[1] %></span> <%= CONF.MIDDLE_WARE['database_list'][databases[1]]['sel'] %></a>\n\t\t<% } %>\n\t<% } %>\n\t<span class=\"close-notification\"></span>\n</div>"
  5491.     }
  5492.     , function(module, exports, __webpack_require__) {
  5493.         var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  5494.         !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(39), __webpack_require__(4), __webpack_require__(5)],
  5495.         __WEBPACK_AMD_DEFINE_RESULT__ = function(_, HEADER_TEMPLATE, Backbone) {
  5496.             "use strict";
  5497.             var getGaWidgetName = function(type) {
  5498.                 return (type === 'organic' ? 'Organic' : 'Paid') + ' position distribution';
  5499.             }
  5500.             var gaClickOnTitle = function(type) {
  5501.                 sendGa(type, 'click to title');
  5502.             }
  5503.             var gaClickOnRange = function(type) {
  5504.                 sendGa(type, 'click to range');
  5505.             }
  5506.             var sendGa = function(type, label) {
  5507.                 if (typeof ga !== 'undefined') {
  5508.                     ga('send', 'event', 'Domain overview', getGaWidgetName(type), label);
  5509.                 }
  5510.             }
  5511.             return Backbone.View.extend({
  5512.                 initialize: function(options, reportConfig) {
  5513.                     var CONF = this.CONF = options;
  5514.                     this.reportConfig = {
  5515.                         el: $(CONF.EL),
  5516.                         title: CONF.LOCALE.title,
  5517.                         tooltip: CONF.LOCALE.title_tooltip,
  5518.                         title_href: app.conf.DB_PREFIX + app.conf.DB_DATE_PREFIX + "/info/" + CONF.MIDDLE_WARE.domain_id + "+(by+" + CONF.MIDDLE_WARE.type + ")",
  5519.                         MIDDLE_WARE: CONF.MIDDLE_WARE,
  5520.                         LOCALE: CONF.LOCALE,
  5521.                         needToLogNothingFound: true,
  5522.                         gaLabel: getGaWidgetName(CONF.MIDDLE_WARE.type) + ' - Overview',
  5523.                         reports: [{
  5524.                             back: (function() {
  5525.                                 var foo = {
  5526.                                     key: app.conf.KEY,
  5527.                                     url: CONF.MIDDLE_WARE.backend_url,
  5528.                                     domain: CONF.MIDDLE_WARE.domain_id,
  5529.                                     action: "report",
  5530.                                     type: "domain_rank",
  5531.                                     responceAction: "rank"
  5532.                                 };
  5533.                                 if (CONF.MIDDLE_WARE.exportHash) {
  5534.                                     foo.display_hash = CONF.MIDDLE_WARE.exportHash;
  5535.                                 }
  5536.                                 if (CONF.MIDDLE_WARE.db_currency) {
  5537.                                     foo.currency = CONF.MIDDLE_WARE.db_currency;
  5538.                                 }
  5539.                                 if (CONF.MIDDLE_WARE.api_display_date && CONF.MIDDLE_WARE.api_display_date !== 'current') {
  5540.                                     foo.display_date = CONF.MIDDLE_WARE.api_display_date;
  5541.                                 }
  5542.                                 return foo;
  5543.                             }
  5544.                             )()
  5545.                         }],
  5546.                         templates: {
  5547.                             header: HEADER_TEMPLATE
  5548.                         },
  5549.                         chartOptions: {
  5550.                             colors: ['rgba(188, 222, 247, 0.75)'],
  5551.                             chart: {
  5552.                                 spacingTop: 10,
  5553.                                 spacingLeft: -5,
  5554.                                 spacingRight: 0,
  5555.                                 spacingBottom: 10,
  5556.                                 backgroundColor: CONF.MIDDLE_WARE.show_watermark ? null : '#fff',
  5557.                                 type: 'column',
  5558.                                 height: 222
  5559.                             },
  5560.                             title: {
  5561.                                 text: null
  5562.                             },
  5563.                             plotOptions: {
  5564.                                 column: {
  5565.                                     pointPadding: 0,
  5566.                                     events: {
  5567.                                         click: function(event) {
  5568.                                             gaClickOnRange(CONF.MIDDLE_WARE.type);
  5569.                                             document.location = getLink(event.point.x);
  5570.                                         }
  5571.                                     }
  5572.                                 },
  5573.                                 series: {
  5574.                                     shadow: false
  5575.                                 }
  5576.                             },
  5577.                             xAxis: {
  5578.                                 gridLineWidth: 0,
  5579.                                 lineColor: '#cccccc',
  5580.                                 labels: {
  5581.                                     y: 20,
  5582.                                     style: {
  5583.                                         fontFamily: 'Ubuntu, Arial',
  5584.                                         fontSize: 13,
  5585.                                         color: '#999999'
  5586.                                     }
  5587.                                 },
  5588.                                 tickWidth: 0,
  5589.                                 categories: function() {
  5590.                                     if (CONF.MIDDLE_WARE.keywords_positions == 100) {
  5591.                                         return ['1-3', '4-10', '11-20', '21-30', '31-40', '41-50', '51-60', '61-70', '71-80', '81-90', '91-100'];
  5592.                                     } else {
  5593.                                         return [CONF.LOCALE.top_3, CONF.LOCALE.first_page, CONF.LOCALE.second_page];
  5594.                                     }
  5595.                                 }()
  5596.                             },
  5597.                             yAxis: {
  5598.                                 min: 0,
  5599.                                 minTickInterval: 1,
  5600.                                 gridLineWidth: 0,
  5601.                                 title: {
  5602.                                     text: CONF.LOCALE.title_y,
  5603.                                     x: 5,
  5604.                                     style: {
  5605.                                         fontSize: 12,
  5606.                                         fontFamily: 'Ubuntu, Arial',
  5607.                                         color: '#53a5e0'
  5608.                                     }
  5609.                                 },
  5610.                                 showFirstLabel: false,
  5611.                                 labels: {
  5612.                                     x: 0,
  5613.                                     style: {
  5614.                                         fontSize: 12,
  5615.                                         color: '#999999'
  5616.                                     },
  5617.                                     formatter: function() {
  5618.                                         return (app.helper.roundNumRankNew(this.value) + '').toUpperCase();
  5619.                                     }
  5620.                                 }
  5621.                             },
  5622.                             tooltip: {
  5623.                                 useHTML: true,
  5624.                                 formatter: function() {
  5625.                                     return CONF.LOCALE.clm_tooltip + ": " + "<a href='" + getLink(this.point.x) + "'>" + app.numberFormat(this.y, 0, ".", ",") + "</a>";
  5626.                                 }
  5627.                             },
  5628.                             legend: {
  5629.                                 enabled: false
  5630.                             }
  5631.                         },
  5632.                         getData: function(backendReports) {
  5633.                             var data = []
  5634.                               , postfixes = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a"];
  5635.                             if (CONF.MIDDLE_WARE.type == 'organic' && CONF.MIDDLE_WARE.keywords_positions == 20) {
  5636.                                 postfixes = _.take(postfixes, 3);
  5637.                             }
  5638.                             var col = _.values(backendReports.attributes)[0];
  5639.                             var currentItem;
  5640.                             col.each(function(item) {
  5641.                                 currentItem = item;
  5642.                             });
  5643.                             if (currentItem) {
  5644.                                 if (CONF.MIDDLE_WARE.type === "organic") {
  5645.                                     for (var j = 0; j < postfixes.length; j++) {
  5646.                                         data.push({
  5647.                                             y: parseInt(currentItem.get("X" + postfixes[j]))
  5648.                                         });
  5649.                                     }
  5650.                                 } else {
  5651.                                     var getPositionRange = function(top, btm) {
  5652.                                         return _.reduce(postfixes.slice(top, btm), function(memo, item) {
  5653.                                             return memo += parseInt(currentItem.get('Y' + item));
  5654.                                         }, 0)
  5655.                                     };
  5656.                                     data.push({
  5657.                                         y: getPositionRange(0, 3)
  5658.                                     });
  5659.                                     data.push({
  5660.                                         y: getPositionRange(3, 8)
  5661.                                     });
  5662.                                     data.push({
  5663.                                         y: getPositionRange(8, postfixes.length)
  5664.                                     });
  5665.                                 }
  5666.                             }
  5667.                             data = _.dropRightWhile(data, function(item) {
  5668.                                 return !item.y
  5669.                             });
  5670.                             if (data.length) {
  5671.                                 if (data.length < 3) {
  5672.                                     for (var i = data.length; i < 3; i++) {
  5673.                                         data.push({
  5674.                                             y: 0
  5675.                                         });
  5676.                                     }
  5677.                                 }
  5678.                                 return [{
  5679.                                     data: data
  5680.                                 }];
  5681.                             }
  5682.                             return false;
  5683.                         }
  5684.                     };
  5685.                     if (reportConfig) {
  5686.                         app.deepExtend(this.reportConfig, reportConfig);
  5687.                     }
  5688.                     var getLink = function(pointX) {
  5689.                         var filter;
  5690.                         switch (pointX) {
  5691.                         case 0:
  5692.                             filter = '+|Po|Lt|4';
  5693.                             break;
  5694.                         case 1:
  5695.                             filter = (CONF.MIDDLE_WARE.type == 'organic' ? '+|Po|Gt|3|+|Po|Lt|11' : '+|Po|Gt|3|+|Po|Lt|9');
  5696.                             break;
  5697.                         default:
  5698.                             if (CONF.MIDDLE_WARE.type == 'adwords') {
  5699.                                 filter = '+|Po|Gt|8';
  5700.                             } else if (CONF.MIDDLE_WARE.keywords_positions == 100) {
  5701.                                 filter = '+|Po|Gt|' + ((pointX - 1) * 10) + '|+|Po|Lt|' + (pointX * 10 + 1);
  5702.                             } else {
  5703.                                 filter = '+|Po|Gt|10';
  5704.                             }
  5705.                         }
  5706.                         return app.conf.DB_PREFIX + app.conf.DB_DATE_PREFIX + "/info/" + CONF.MIDDLE_WARE.domain_id + " (by " + CONF.MIDDLE_WARE.type + ")?filter=" + encodeURIComponent(filter);
  5707.                     };
  5708.                     return this.render();
  5709.                 },
  5710.                 render: function() {
  5711.                     var CONF = this.CONF
  5712.                     return new (app.ReportChart.extend({
  5713.                         events: {
  5714.                             "click .sem-widget-try-again": "tryAgainHandler",
  5715.                             'click .sem-widget-header-title a': function(e) {
  5716.                                 gaClickOnTitle(CONF.MIDDLE_WARE.type);
  5717.                             }
  5718.                         }
  5719.                     }))(this.reportConfig);
  5720.                 }
  5721.             });
  5722.         }
  5723.         .apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  5724.         __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  5725.     }
  5726.     , function(module, exports, __webpack_require__) {
  5727.         var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  5728.         !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(102), __webpack_require__(72), __webpack_require__(39), __webpack_require__(4), __webpack_require__(5)],
  5729.         __WEBPACK_AMD_DEFINE_RESULT__ = function(_, TR_TEMPLATE, FOOTER_TEMPLATE, HEADER_TEMPLATE, Backbone) {
  5730.             "use strict";
  5731.             var getGaWidgetName = function() {
  5732.                 return 'Sample ads'
  5733.             }
  5734.             var gaClickOnTitle = function() {
  5735.                 sendGa('click to title')
  5736.             }
  5737.             var gaClickOnButton = function() {
  5738.                 sendGa('click to button')
  5739.             }
  5740.             var gaClickOnSample = function() {
  5741.                 sendGa('click to a sample')
  5742.             }
  5743.             var sendGa = function(label) {
  5744.                 if (typeof ga !== 'undefined') {
  5745.                     ga('send', 'event', 'Domain overview', getGaWidgetName(), label);
  5746.                 }
  5747.             }
  5748.             return Backbone.View.extend({
  5749.                 initialize: function(options, reportConfig) {
  5750.                     var CONF = this.CONF = options;
  5751.                     this.reportConfig = {
  5752.                         el: $(CONF.EL),
  5753.                         title: CONF.LOCALE.title,
  5754.                         tooltip: CONF.LOCALE.title_tooltip,
  5755.                         title_href: app.conf.DB_PREFIX + app.conf.DB_DATE_PREFIX + "/info/" + CONF.MIDDLE_WARE.domain_id + "+(by+uniq_ads)",
  5756.                         MIDDLE_WARE: CONF.MIDDLE_WARE,
  5757.                         LOCALE: CONF.LOCALE,
  5758.                         fullReportLink: app.conf.DB_PREFIX + app.conf.DB_DATE_PREFIX + '/info/' + CONF.MIDDLE_WARE.domain_id + '+(by+uniq_ads)',
  5759.                         needToLogNothingFound: true,
  5760.                         gaLabel: getGaWidgetName() + ' - Overview',
  5761.                         reports: [{
  5762.                             back: (function() {
  5763.                                 var foo = {
  5764.                                     key: app.conf.KEY,
  5765.                                     url: CONF.MIDDLE_WARE.backend_url,
  5766.                                     domain: CONF.MIDDLE_WARE.domain_id,
  5767.                                     display_hash: CONF.MIDDLE_WARE.exportHash,
  5768.                                     action: "report",
  5769.                                     type: "domain_overview_adwords",
  5770.                                     responceAction: "overview_adwords",
  5771.                                     display_sort: "tr_desc",
  5772.                                     currency: CONF.MIDDLE_WARE.db_currency
  5773.                                 };
  5774.                                 if (CONF.MIDDLE_WARE.api_display_date && CONF.MIDDLE_WARE.api_display_date !== 'current') {
  5775.                                     foo.display_date = CONF.MIDDLE_WARE.api_display_date;
  5776.                                 }
  5777.                                 return foo;
  5778.                             }
  5779.                             )()
  5780.                         }],
  5781.                         overview: true,
  5782.                         templates: {
  5783.                             header: HEADER_TEMPLATE,
  5784.                             footer: FOOTER_TEMPLATE
  5785.                         },
  5786.                         labelClass: CONF.MIDDLE_WARE.labelClass,
  5787.                         labelText: CONF.MIDDLE_WARE.labelText,
  5788.                         table: {
  5789.                             templates: {
  5790.                                 data: function() {
  5791.                                     return "<% if (typeof data !== \"undefined\" && data.length) { %>" + "<tr class=\"sem-widget-overview-info\">" + "<% data.each(function(item, countTr) { %>" + "<% if (countTr < 4) { %>" + this.template("tr") + "<% } %>" + "<% if (countTr < 3) { %>" + "<td><div style=\"width: 27px; display: block;\"></div></td>" + "<% } %>" + "<% }); %>" + "</tr>" + "<% } else { %>" + "<td<% if (typeof header !== \"undefined\" && header.length) { %>" + "colspan=\"<%= header.length %>\"<% } %> class=\"sem-widgets-no-results\"" + ">" + this.template("nothingFound") + "</td>" + "<% } %>";
  5792.                                 },
  5793.                                 tr: TR_TEMPLATE,
  5794.                                 th: ''
  5795.                             }
  5796.                         }
  5797.                     };
  5798.                     if (reportConfig) {
  5799.                         app.deepExtend(this.reportConfig, reportConfig);
  5800.                     }
  5801.                     return this.render();
  5802.                 },
  5803.                 render: function() {
  5804.                     return new (app.ReportTable.extend({
  5805.                         nothingFoundEl: ".sem-widget-content",
  5806.                         events: {
  5807.                             'click .sem-widget-header-title a': gaClickOnTitle,
  5808.                             'click .sem-report-block-full-report a': gaClickOnButton,
  5809.                             'click .sem-widget-overview-info a': gaClickOnSample,
  5810.                             'click .sem-widget-try-again': 'tryAgainHandler'
  5811.                         }
  5812.                     }))(this.reportConfig);
  5813.                 }
  5814.             });
  5815.         }
  5816.         .apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  5817.         __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  5818.     }
  5819.     , function(module, exports) {
  5820.         module.exports = "<td style=\"width: 25%;\">\n\t<a href=\"<%= decodeURIComponent(item.get(\"Ur\")) %>\" target=\"_blank\"><%= item.get(\"Tt\").replace(/<\\/a>.+/i, \"\") %></a>\n\t<% if (item.get(\"Vu\")) { %>\n\t<div class=\"sem-widget-type-ads-domain\" title=\"<%= item.get(\"Vu\") %>\"><span class=\"sem-report-block-ad\">Ad</span><%= item.get(\"Vu\") %></div>\n\t<% } %>\n\t<div><%= helper.replaceAdvDescription(item.get(\"Ds\")) %></div>\n</td>\n"
  5821.     }
  5822.     , function(module, exports, __webpack_require__) {
  5823.         var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  5824.         !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(104), __webpack_require__(4)],
  5825.         __WEBPACK_AMD_DEFINE_RESULT__ = function(_, CONTENT_TEMPLATE, Backbone) {
  5826.             "use strict";
  5827.             return Backbone.View.extend({
  5828.                 initialize: function(options, reportConfig) {
  5829.                     var CONF = this.CONF = options;
  5830.                     this.reportConfig = {
  5831.                         el: $(CONF.EL),
  5832.                         MIDDLE_WARE: CONF.MIDDLE_WARE,
  5833.                         LOCALE: CONF.LOCALE,
  5834.                         reports: [{
  5835.                             back: {
  5836.                                 key: app.conf.KEY,
  5837.                                 url: CONF.MIDDLE_WARE.backend_url,
  5838.                                 type: "backlinks_overview",
  5839.                                 method: "nojsonp",
  5840.                                 target: CONF.MIDDLE_WARE.link,
  5841.                                 target_type: CONF.MIDDLE_WARE.target_type,
  5842.                                 responceAction: "data",
  5843.                                 export_columns: CONF.MIDDLE_WARE.export_columns,
  5844.                                 display_hash: CONF.MIDDLE_WARE.display_hash
  5845.                             }
  5846.                         }],
  5847.                         templates: {
  5848.                             header: "",
  5849.                             content: CONTENT_TEMPLATE,
  5850.                             widget: function() {
  5851.                                 var header = this.template("header")
  5852.                                   , footer = this.template("footer")
  5853.                                   , ret = "";
  5854.                                 if (header) {
  5855.                                     ret += "<div class=\"sem-widget-header\">" + header + "</div>";
  5856.                                 }
  5857.                                 ret += "<div class=\"sem-widget-content\">";
  5858.                                 ret += "<div class=\"sem-widget-loader\"></div>";
  5859.                                 ret += "</div>";
  5860.                                 if (this.noResults) {
  5861.                                     ret += this.template("noResults");
  5862.                                 } else if (this.serverError) {
  5863.                                     ret += this.template("serverError");
  5864.                                 } else {
  5865.                                     ret += this.template("content");
  5866.                                 }
  5867.                                 if (footer) {
  5868.                                     ret += "<div class=\"sem-widget-footer clearfix\">" + this.template("footer") + "</div>";
  5869.                                 }
  5870.                                 return ret;
  5871.                             }
  5872.                         },
  5873.                         table: {
  5874.                             header: [],
  5875.                             footer: ''
  5876.                         },
  5877.                         getData: function(backendReports) {
  5878.                             var foo = _.values(backendReports.attributes)[0]
  5879.                               , response = foo.responce;
  5880.                             if (foo.loaded) {
  5881.                                 if (response.attributes.total == undefined) {
  5882.                                     response.attributes.total = 0;
  5883.                                     response.attributes.domains = 0;
  5884.                                     response.attributes.ip = 0;
  5885.                                 }
  5886.                             }
  5887.                             return response;
  5888.                         }
  5889.                     };
  5890.                     if (reportConfig) {
  5891.                         app.deepExtend(this.reportConfig, reportConfig);
  5892.                     }
  5893.                     return this.render();
  5894.                 },
  5895.                 render: function() {
  5896.                     return new app.ReportWidget(this.reportConfig);
  5897.                 }
  5898.             })
  5899.         }
  5900.         .apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  5901.         __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  5902.     }
  5903.     , function(module, exports) {
  5904.         module.exports = "<% if (typeof data !== \"undefined\" && typeof data.attributes !== \"undefined\") { %>\n\t<div class=\"sem-report-block-flag-counter sem-report-with-tooltip\">\n\t\t<a href=\"<%= app.conf.DB_PREFIX + app.conf.DB_DATE_PREFIX %>/info/<%= MIDDLE_WARE.link %>+(backlinks)?target_type=<%= MIDDLE_WARE.target_type %>\"><%= helper.roundNumRankFormatted(data.attributes.total) %></a>\n\t\t<div class=\"sem-report-tooltip-right\"><%= LOCALE.total_tooltip %></div>\n\t</div>\n\t<%= LOCALE.total %>\n\t<div class=\"sem-report-block-flag-counter-delimiter\"></div>\n\t<div class=\"sem-report-block-flag-counter sem-report-with-tooltip\">\n        <a href=\"<%= app.conf.DB_PREFIX + app.conf.DB_DATE_PREFIX %>/info/<%= MIDDLE_WARE.link %>+(backlinks_refdomains)?target_type=<%= MIDDLE_WARE.target_type %>\"><%= helper.roundNumRankFormatted(data.attributes.domains) %></a>\n\t\t<div class=\"sem-report-tooltip-right\"><%= LOCALE.referring_domains_tooltip %></div>\n\t</div>\n\t<%= LOCALE.referring_domains %>\n\t<div class=\"sem-report-block-flag-counter-delimiter\"></div>\n\t<div class=\"sem-report-block-flag-counter sem-report-with-tooltip\">\n        <a href=\"<%= app.conf.DB_PREFIX + app.conf.DB_DATE_PREFIX %>/info/<%= MIDDLE_WARE.link %>+(backlinks_refips)?target_type=<%= MIDDLE_WARE.target_type %>\"><%= helper.roundNumRankFormatted(data.attributes.ip) %></a>\n\t\t<div class=\"sem-report-tooltip-right\"><%= LOCALE.referring_ips_tooltip %></div>\n\t</div>\n\t<%= LOCALE.referring_ips %>\n\t<div><i class=\"sem-arrow-down\"></i></div>\n<% } %>\n"
  5905.     }
  5906.     , function(module, exports, __webpack_require__) {
  5907.         var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  5908.         !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(106), __webpack_require__(39), __webpack_require__(4), __webpack_require__(5)],
  5909.         __WEBPACK_AMD_DEFINE_RESULT__ = function(_, LEGEND_TEMPLATE, HEADER_TEMPLATE, Backbone) {
  5910.             "use strict";
  5911.             var getGaWidgetName = function() {
  5912.                 return 'Follow vs nofollow'
  5913.             }
  5914.             var gaClickToFollow = function() {
  5915.                 sendGa('click to follow')
  5916.             }
  5917.             var gaClickToNoFollow = function() {
  5918.                 sendGa('click to nofollow')
  5919.             }
  5920.             var sendGa = function(label) {
  5921.                 if (typeof ga === 'undefined')
  5922.                     return;
  5923.                 var action = getGaWidgetName();
  5924.                 ga('send', 'event', 'Domain overview', action, label);
  5925.             }
  5926.             return Backbone.View.extend({
  5927.                 initialize: function(options, reportConfig) {
  5928.                     var CONF = this.CONF = options;
  5929.                     var self = this;
  5930.                     this.reportConfig = {
  5931.                         el: $(CONF.EL),
  5932.                         MIDDLE_WARE: CONF.MIDDLE_WARE,
  5933.                         LOCALE: CONF.LOCALE,
  5934.                         needToLogNothingFound: true,
  5935.                         gaLabel: getGaWidgetName() + ' - Overview',
  5936.                         reports: [{
  5937.                             back: {
  5938.                                 key: app.conf.KEY,
  5939.                                 url: CONF.MIDDLE_WARE.backend_url,
  5940.                                 type: "backlinks_overview",
  5941.                                 method: "nojsonp",
  5942.                                 target: CONF.MIDDLE_WARE.link,
  5943.                                 target_type: CONF.MIDDLE_WARE.target_type,
  5944.                                 responceAction: "data",
  5945.                                 display_hash: CONF.MIDDLE_WARE.display_hash,
  5946.                                 export_columns: CONF.MIDDLE_WARE.export_columns
  5947.                             }
  5948.                         }],
  5949.                         chartOptions: {
  5950.                             chart: {
  5951.                                 type: 'pie',
  5952.                                 spacingTop: 0,
  5953.                                 spacingLeft: 0,
  5954.                                 spacingRight: 0,
  5955.                                 spacingBottom: 0,
  5956.                                 height: CONF.MIDDLE_WARE.height
  5957.                             },
  5958.                             legend: {
  5959.                                 enabled: false
  5960.                             },
  5961.                             title: false,
  5962.                             plotOptions: {
  5963.                                 pie: {
  5964.                                     size: "100%",
  5965.                                     shadow: false,
  5966.                                     center: ['35%', '50%'],
  5967.                                     dataLabels: {
  5968.                                         enabled: false
  5969.                                     },
  5970.                                     startAngle: 90,
  5971.                                     borderWidth: 0
  5972.                                 }
  5973.                             },
  5974.                             series: [{
  5975.                                 size: '100%',
  5976.                                 innerSize: '80%',
  5977.                                 point: {
  5978.                                     events: {
  5979.                                         click: function(e) {
  5980.                                             if (e.target.point.index === 1) {
  5981.                                                 gaClickToFollow();
  5982.                                             } else {
  5983.                                                 gaClickToNoFollow();
  5984.                                             }
  5985.                                             location.href = this.options.url;
  5986.                                         }
  5987.                                     }
  5988.                                 }
  5989.                             }],
  5990.                             tooltip: {
  5991.                                 snap: 2,
  5992.                                 formatter: function() {
  5993.                                     return this.y > 1 ? '<b>' + this.point.name + ':</b> ' + app.numberFormat(this.y, 2, ".", ",") + '%' : null;
  5994.                                 }
  5995.                             }
  5996.                         },
  5997.                         templates: {
  5998.                             nothingFound: function() {
  5999.                                 return "<div class=\"sem-widget-nothing-found-style\">" + CONF.LOCALE.no_trend_data + "</div>";
  6000.                             },
  6001.                             header: "",
  6002.                             footer: "",
  6003.                             legend: LEGEND_TEMPLATE
  6004.                         },
  6005.                         getData: function(backendReports) {
  6006.                             var backendModel = _.values(backendReports.attributes)[0]
  6007.                               , result = []
  6008.                               , response = backendModel.responce;
  6009.                             if (typeof response !== "undefined" && response.attributes) {
  6010.                                 if (response.attributes.total === 0)
  6011.                                     return false;
  6012.                                 result[0] = {
  6013.                                     data: []
  6014.                                 };
  6015.                                 var follow = 0
  6016.                                   , nofollow = 0
  6017.                                   , followY = 100
  6018.                                   , nofollowY = 0
  6019.                                   , zeroData = true;
  6020.                                 if (backendModel.loaded && response.attributes.follow != undefined) {
  6021.                                     follow = response.attributes.follow;
  6022.                                     nofollow = response.attributes.nofollow;
  6023.                                     var sum = follow + nofollow;
  6024.                                     if (sum != 0) {
  6025.                                         zeroData = false;
  6026.                                         followY = follow * 100 / sum;
  6027.                                         nofollowY = 100 - followY;
  6028.                                     }
  6029.                                 }
  6030.                                 var links = self.createFilterLinks()
  6031.                                 result[0].data.push({
  6032.                                     name: CONF.LOCALE.nofollow,
  6033.                                     y: nofollowY,
  6034.                                     color: app.HighChartsColors[1],
  6035.                                     count: nofollow,
  6036.                                     url: links.nofollow
  6037.                                 }, {
  6038.                                     name: CONF.LOCALE.dofollow,
  6039.                                     y: followY,
  6040.                                     color: app.HighChartsColors[0],
  6041.                                     zeroData: zeroData,
  6042.                                     count: follow,
  6043.                                     url: links.follow
  6044.                                 });
  6045.                             }
  6046.                             return result;
  6047.                         }
  6048.                     };
  6049.                     if (CONF.LOCALE.title) {
  6050.                         this.reportConfig.title = CONF.LOCALE.title;
  6051.                         this.reportConfig.title_href = '/analytics/backlinks/backlinks/' + encodeURIComponent(this.CONF.MIDDLE_WARE.link) + ':' + this.CONF.MIDDLE_WARE.target_type;
  6052.                         this.reportConfig.templates.header = HEADER_TEMPLATE;
  6053.                     }
  6054.                     if (reportConfig) {
  6055.                         app.deepExtend(this.reportConfig, reportConfig);
  6056.                     }
  6057.                     return this.render();
  6058.                 },
  6059.                 createFilterLinks: function() {
  6060.                     var nofollowFilter = "+|type||nofollow"
  6061.                       , followFilter = "-|type||nofollow"
  6062.                       , currentLink = '/analytics/backlinks/backlinks/' + encodeURIComponent(this.CONF.MIDDLE_WARE.link) + ':' + this.CONF.MIDDLE_WARE.target_type;
  6063.                     return {
  6064.                         follow: currentLink + "?filter=" + encodeURIComponent(followFilter),
  6065.                         nofollow: currentLink + "?filter=" + encodeURIComponent(nofollowFilter)
  6066.                     };
  6067.                 },
  6068.                 render: function() {
  6069.                     return new (app.ReportChart.extend({
  6070.                         events: {
  6071.                             'click .backlinks-follow': gaClickToFollow,
  6072.                             'click .backlinks-nofollow': gaClickToNoFollow,
  6073.                             'click .sem-widget-try-again': 'tryAgainHandler'
  6074.                         },
  6075.                         afterRender: function() {
  6076.                             var data = this._getData();
  6077.                             if (data.length) {
  6078.                                 var nofollowY = data[0].data[0].y
  6079.                                   , angle = 90 - 180 * nofollowY / 100
  6080.                                   , reportData = {
  6081.                                     follow: 0,
  6082.                                     nofollow: 0,
  6083.                                     zeroData: data[0].data[1].zeroData
  6084.                                 };
  6085.                                 this.options.chartOptions.plotOptions.pie.startAngle = angle;
  6086.                                 if (!reportData.zeroData) {
  6087.                                     reportData.follow = data[0].data[1].count;
  6088.                                     reportData.nofollow = data[0].data[0].count;
  6089.                                     reportData.followLink = data[0].data[1].url;
  6090.                                     reportData.nofollowLink = data[0].data[0].url;
  6091.                                 }
  6092.                                 var templateData = this.getTemplateData();
  6093.                                 templateData.data = reportData;
  6094.                                 $(this.el).append(_.template(this.template("legend"))(templateData));
  6095.                             }
  6096.                             app.ReportChart.prototype.afterRender.apply(this, arguments);
  6097.                         }
  6098.                     }))(this.reportConfig);
  6099.                 }
  6100.             });
  6101.         }
  6102.         .apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  6103.         __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  6104.     }
  6105.     , function(module, exports) {
  6106.         module.exports = "<% if (typeof data !== \"undefined\") { %>\n<div class=\"sem-report-block-legend-new\">\n\t<a class=\"backlinks-follow\" href=\"<%= data.followLink %>\"><div class=\"sem-report-block-counter-new\" data-test-domain-overview-follow-widget-follow-links-count><%= helper.roundNumRankFormatted(data.follow) %></div>\n\t\t<div class=\"sem-report-counter-legend-new\"><%= LOCALE.dofollow %></div></a>\n\t<a class=\"backlinks-nofollow\" href=\"<%= data.nofollowLink %>\"><div class=\"sem-report-block-counter-new\" data-test-domain-overview-follow-widget-nofollow-links-count><%= helper.roundNumRankFormatted(data.nofollow) %></div>\n\t\t<div class=\"sem-report-counter-legend-new sem-report-counter-legend-new-1\"><%= LOCALE.nofollow %></div></a>\n</div>\n<% } %>\n"
  6107.     }
  6108.     , function(module, exports, __webpack_require__) {
  6109.         var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  6110.         !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(108), __webpack_require__(39), __webpack_require__(4), __webpack_require__(5)],
  6111.         __WEBPACK_AMD_DEFINE_RESULT__ = function(_, LEGEND_TEMPLATE, HEADER_TEMPLATE, Backbone) {
  6112.             "use strict";
  6113.             var gaClickToChart = function(type) {
  6114.                 switch (type) {
  6115.                 case 0:
  6116.                     sendGa('click to frame links');
  6117.                     break;
  6118.                 case 1:
  6119.                     sendGa('click to form links');
  6120.                     break;
  6121.                 case 2:
  6122.                     sendGa('click to image links');
  6123.                     break;
  6124.                 case 3:
  6125.                     sendGa('click to text links');
  6126.                     break;
  6127.                 }
  6128.             }
  6129.             var sendGa = function(label) {
  6130.                 if (typeof ga === 'undefined')
  6131.                     return;
  6132.                 var action = 'Backlink type';
  6133.                 ga('send', 'event', 'Domain overview', action, label);
  6134.             }
  6135.             return Backbone.View.extend({
  6136.                 initialize: function(options, reportConfig) {
  6137.                     var CONF = this.CONF = options;
  6138.                     var self = this;
  6139.                     this.reportConfig = {
  6140.                         el: $(CONF.EL),
  6141.                         MIDDLE_WARE: CONF.MIDDLE_WARE,
  6142.                         LOCALE: CONF.LOCALE,
  6143.                         needToLogNothingFound: true,
  6144.                         reports: [{
  6145.                             back: {
  6146.                                 key: app.conf.KEY,
  6147.                                 url: CONF.MIDDLE_WARE.backend_url,
  6148.                                 type: "backlinks_overview",
  6149.                                 method: "nojsonp",
  6150.                                 target: CONF.MIDDLE_WARE.link,
  6151.                                 target_type: CONF.MIDDLE_WARE.target_type,
  6152.                                 responceAction: "data",
  6153.                                 display_hash: CONF.MIDDLE_WARE.display_hash,
  6154.                                 export_columns: CONF.MIDDLE_WARE.export_columns
  6155.                             }
  6156.                         }],
  6157.                         chartOptions: {
  6158.                             chart: {
  6159.                                 type: 'pie',
  6160.                                 spacingTop: 0,
  6161.                                 spacingLeft: 0,
  6162.                                 spacingRight: 0,
  6163.                                 spacingBottom: 0,
  6164.                                 height: CONF.MIDDLE_WARE.height
  6165.                             },
  6166.                             legend: {
  6167.                                 enabled: false
  6168.                             },
  6169.                             title: false,
  6170.                             plotOptions: {
  6171.                                 pie: {
  6172.                                     size: "100%",
  6173.                                     shadow: false,
  6174.                                     center: ['35%', '50%'],
  6175.                                     dataLabels: {
  6176.                                         enabled: false
  6177.                                     },
  6178.                                     startAngle: 90,
  6179.                                     borderWidth: 0
  6180.                                 }
  6181.                             },
  6182.                             series: [{
  6183.                                 size: '100%',
  6184.                                 innerSize: '80%',
  6185.                                 point: {
  6186.                                     events: {
  6187.                                         click: function(e) {
  6188.                                             gaClickToChart(e.target.point.index);
  6189.                                             location.href = this.options.url;
  6190.                                         }
  6191.                                     }
  6192.                                 },
  6193.                                 states: {
  6194.                                     hover: {
  6195.                                         enabled: true,
  6196.                                         halo: false
  6197.                                     }
  6198.                                 }
  6199.                             }],
  6200.                             tooltip: {
  6201.                                 snap: 2,
  6202.                                 formatter: function() {
  6203.                                     return '<b>' + this.point.name + ':</b> ' + app.numberFormat(this.point.yReal, 2, ".", ",") + '%';
  6204.                                 }
  6205.                             }
  6206.                         },
  6207.                         templates: {
  6208.                             nothingFound: function() {
  6209.                                 return '<div class="sem-widget-nothing-found-style">' + CONF.LOCALE.no_trend_data + '</div>';
  6210.                             },
  6211.                             header: '',
  6212.                             footer: '',
  6213.                             legend: LEGEND_TEMPLATE
  6214.                         },
  6215.                         getData: function(backendReports) {
  6216.                             var approxYsector = function(realY) {
  6217.                                 if (realY > 2 || realY === 0)
  6218.                                     return realY;
  6219.                                 return (realY > 1) ? 2 : 1;
  6220.                             };
  6221.                             var backendModel = _.values(backendReports.attributes)[0]
  6222.                               , result = []
  6223.                               , response = backendModel.responce;
  6224.                             if (typeof response !== "undefined" && response.attributes) {
  6225.                                 if (response.attributes.total === 0)
  6226.                                     return false;
  6227.                                 result[0] = {
  6228.                                     data: []
  6229.                                 };
  6230.                                 var frame = 0
  6231.                                   , frameY = 0
  6232.                                   , frameYreal = 0
  6233.                                   , form = 0
  6234.                                   , formY = 0
  6235.                                   , formYreal = 0
  6236.                                   , image = 0
  6237.                                   , imageY = 0
  6238.                                   , imageYreal = 0
  6239.                                   , text = 0
  6240.                                   , textY = 100
  6241.                                   , textYreal = 100
  6242.                                   , total = 0
  6243.                                   , zeroData = true;
  6244.                                 if (backendModel.loaded && response.attributes.frame !== undefined) {
  6245.                                     frame = response.attributes.frame;
  6246.                                     form = response.attributes.form;
  6247.                                     image = response.attributes.image;
  6248.                                     total = response.attributes.total;
  6249.                                     text = response.attributes.text || total - (form + frame + image);
  6250.                                     if (total !== 0) {
  6251.                                         zeroData = false;
  6252.                                         frameYreal = frame * 100 / total;
  6253.                                         formYreal = form * 100 / total;
  6254.                                         imageYreal = image * 100 / total;
  6255.                                         textYreal = 100 - (frameYreal + formYreal + imageYreal);
  6256.                                         frameY = approxYsector(frameYreal);
  6257.                                         formY = approxYsector(formYreal);
  6258.                                         imageY = approxYsector(imageYreal);
  6259.                                         textY = 100 - (frameY + formY + imageY);
  6260.                                     }
  6261.                                 }
  6262.                                 var links = self.createFilterLinks();
  6263.                                 result[0].data.push({
  6264.                                     name: CONF.LOCALE.frame,
  6265.                                     y: frameY,
  6266.                                     yReal: frameYreal,
  6267.                                     color: app.HighChartsColors[1],
  6268.                                     count: frame,
  6269.                                     url: links.frame
  6270.                                 }, {
  6271.                                     name: CONF.LOCALE.form,
  6272.                                     y: formY,
  6273.                                     yReal: formYreal,
  6274.                                     color: app.HighChartsColors[2],
  6275.                                     zeroData: zeroData,
  6276.                                     count: form,
  6277.                                     url: links.form
  6278.                                 }, {
  6279.                                     name: CONF.LOCALE.image,
  6280.                                     y: imageY,
  6281.                                     yReal: imageYreal,
  6282.                                     color: app.HighChartsColors[3],
  6283.                                     zeroData: zeroData,
  6284.                                     count: image,
  6285.                                     url: links.image
  6286.                                 }, {
  6287.                                     name: CONF.LOCALE.text,
  6288.                                     y: textY,
  6289.                                     yReal: textYreal,
  6290.                                     color: app.HighChartsColors[0],
  6291.                                     count: text,
  6292.                                     url: links.text
  6293.                                 });
  6294.                             }
  6295.                             return result;
  6296.                         }
  6297.                     };
  6298.                     if (CONF.LOCALE.title) {
  6299.                         this.reportConfig.title = CONF.LOCALE.title;
  6300.                         this.reportConfig.title_href = '/analytics/backlinks/backlinks/' + encodeURIComponent(this.CONF.MIDDLE_WARE.link) + ':' + this.CONF.MIDDLE_WARE.target_type;
  6301.                         this.reportConfig.templates.header = HEADER_TEMPLATE;
  6302.                     }
  6303.                     if (reportConfig) {
  6304.                         app.deepExtend(this.reportConfig, reportConfig);
  6305.                     }
  6306.                     return this.render();
  6307.                 },
  6308.                 createFilterLinks: function() {
  6309.                     var frameFilter = "+|type||frame"
  6310.                       , formFilter = "+|type||form"
  6311.                       , imageFilter = "+|type||image"
  6312.                       , textFilter = "-|type||form|-|type||frame|-|type||image"
  6313.                       , currentLink = '/analytics/backlinks/backlinks/' + encodeURIComponent(this.CONF.MIDDLE_WARE.link) + ':' + this.CONF.MIDDLE_WARE.target_type;
  6314.                     return {
  6315.                         text: currentLink + "?filter=" + encodeURIComponent(textFilter),
  6316.                         frame: currentLink + "?filter=" + encodeURIComponent(frameFilter),
  6317.                         form: currentLink + "?filter=" + encodeURIComponent(formFilter),
  6318.                         image: currentLink + "?filter=" + encodeURIComponent(imageFilter)
  6319.                     };
  6320.                 },
  6321.                 render: function() {
  6322.                     return new (app.ReportChart.extend({
  6323.                         events: {
  6324.                             'click .legend-text': function() {
  6325.                                 gaClickToChart(3)
  6326.                             },
  6327.                             'click .legend-frame': function() {
  6328.                                 gaClickToChart(0)
  6329.                             },
  6330.                             'click .legend-form': function() {
  6331.                                 gaClickToChart(1)
  6332.                             },
  6333.                             'click .legend-image': function() {
  6334.                                 gaClickToChart(2)
  6335.                             },
  6336.                             'click .sem-widget-try-again': 'tryAgainHandler'
  6337.                         },
  6338.                         afterRender: function() {
  6339.                             var data = this._getData();
  6340.                             if (data.length) {
  6341.                                 var frameY = data[0].data[0].y
  6342.                                   , formY = data[0].data[1].y
  6343.                                   , imageY = data[0].data[2].y
  6344.                                   , angle = 90 - 180 * (frameY + formY + imageY) / 100
  6345.                                   , reportData = {
  6346.                                     text: 0,
  6347.                                     frame: 0,
  6348.                                     form: 0,
  6349.                                     zeroData: data[0].data[1].zeroData
  6350.                                 };
  6351.                                 this.options.chartOptions.plotOptions.pie.startAngle = angle;
  6352.                                 if (!reportData.zeroData) {
  6353.                                     reportData.frame = data[0].data[0].count;
  6354.                                     reportData.form = data[0].data[1].count;
  6355.                                     reportData.image = data[0].data[2].count;
  6356.                                     reportData.text = data[0].data[3].count;
  6357.                                     reportData.frameLink = data[0].data[0].url;
  6358.                                     reportData.formLink = data[0].data[1].url;
  6359.                                     reportData.imageLink = data[0].data[2].url;
  6360.                                     reportData.textLink = data[0].data[3].url;
  6361.                                 }
  6362.                                 var templateData = this.getTemplateData();
  6363.                                 templateData.data = reportData;
  6364.                                 $(this.el).append(_.template(this.template("legend"))(templateData));
  6365.                             }
  6366.                             app.ReportChart.prototype.afterRender.apply(this, arguments);
  6367.                         }
  6368.                     }))(this.reportConfig);
  6369.                 }
  6370.             });
  6371.         }
  6372.         .apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  6373.         __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  6374.     }
  6375.     , function(module, exports) {
  6376.         module.exports = "<% if (typeof data !== \"undefined\") { %>\n<div class=\"sem-report-block-legend-new\">\n\n    <a class=\"legend-text\" href=\"<%= data.textLink %>\"><div class=\"sem-report-block-counter-new\" data-test-domain-overview-backlinks-widget-text-links-count><%= helper.roundNumRankFormatted(data.text) %></div>\n\t\t<div class=\"sem-report-counter-legend-new\"><%= LOCALE.text %></div></a>\n\n    <a class=\"legend-frame\" href=\"<%= data.frameLink %>\"><div class=\"sem-report-block-counter-new\" data-test-domain-overview-backlinks-widget-frame-links-count><%= helper.roundNumRankFormatted(data.frame) %></div>\n        <div class=\"sem-report-counter-legend-new sem-report-counter-legend-new-1\"><%= LOCALE.frame %></div></a>\n\n    <a class=\"legend-form\" href=\"<%= data.formLink %>\"><div class=\"sem-report-block-counter-new\" data-test-domain-overview-backlinks-widget-form-links-count><%= helper.roundNumRankFormatted(data.form) %></div>\n        <div class=\"sem-report-counter-legend-new sem-report-counter-legend-new-2\"><%= LOCALE.form %></div></a>\n\n    <a class=\"legend-image\" href=\"<%= data.imageLink %>\"><div class=\"sem-report-block-counter-new\" data-test-domain-overview-backlinks-widget-image-links-count><%= helper.roundNumRankFormatted(data.image) %></div>\n        <div class=\"sem-report-counter-legend-new sem-report-counter-legend-new-3\"><%= LOCALE.image %></div></a>\n</div>\n<% } %>\n"
  6377.     }
  6378.     , function(module, exports, __webpack_require__) {
  6379.         var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  6380.         !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(110), __webpack_require__(72), __webpack_require__(39), __webpack_require__(4)],
  6381.         __WEBPACK_AMD_DEFINE_RESULT__ = function(_, TR_TEMPLATE, FOOTER_TEMPLATE, HEADER_TEMPLATE, Backbone) {
  6382.             "use strict";
  6383.             var getGaWidgetName = function() {
  6384.                 return 'Backlinks'
  6385.             }
  6386.             var gaClickOnTitle = function() {
  6387.                 sendGa('click to title')
  6388.             }
  6389.             var gaClickOnUrl = function() {
  6390.                 sendGa('click to url')
  6391.             }
  6392.             var gaClickOnButton = function() {
  6393.                 sendGa('click to button')
  6394.             }
  6395.             var gaClickOnExport = function() {
  6396.                 sendGa('click to export')
  6397.             }
  6398.             var sendGa = function(label) {
  6399.                 if (typeof ga !== 'undefined') {
  6400.                     ga('send', 'event', 'Domain overview', getGaWidgetName(), label);
  6401.                 }
  6402.             }
  6403.             return Backbone.View.extend({
  6404.                 initialize: function(options, reportConfig) {
  6405.                     var CONF = this.CONF = options;
  6406.                     this.reportConfig = {
  6407.                         el: $(CONF.EL),
  6408.                         title: CONF.LOCALE.table_title,
  6409.                         title_href: '/analytics/backlinks/backlinks/' + encodeURIComponent(this.CONF.MIDDLE_WARE.target) + ':' + this.CONF.MIDDLE_WARE.target_type,
  6410.                         MIDDLE_WARE: CONF.MIDDLE_WARE,
  6411.                         LOCALE: CONF.LOCALE,
  6412.                         fullReportLink: '/analytics/backlinks/backlinks/' + encodeURIComponent(this.CONF.MIDDLE_WARE.target) + ':' + this.CONF.MIDDLE_WARE.target_type,
  6413.                         needToLogNothingFound: true,
  6414.                         gaLabel: getGaWidgetName() + ' - Overview',
  6415.                         reports: [{
  6416.                             back: {
  6417.                                 key: app.conf.KEY,
  6418.                                 url: CONF.MIDDLE_WARE.backend_url,
  6419.                                 type: "backlinks_overview",
  6420.                                 method: "nojsonp",
  6421.                                 target: CONF.MIDDLE_WARE.target,
  6422.                                 target_type: CONF.MIDDLE_WARE.target_type,
  6423.                                 responceAction: "data",
  6424.                                 display_hash: CONF.MIDDLE_WARE.display_hash,
  6425.                                 export_columns: CONF.MIDDLE_WARE.export_columns
  6426.                             }
  6427.                         }],
  6428.                         overview: true,
  6429.                         table: {
  6430.                             header: (function() {
  6431.                                 var columns = [];
  6432.                                 columns.push({
  6433.                                     title: CONF.LOCALE.backlink_title
  6434.                                 }, {
  6435.                                     title: CONF.LOCALE.backlink_anchor
  6436.                                 }, {
  6437.                                     title: CONF.LOCALE.backlink_type
  6438.                                 });
  6439.                                 return columns;
  6440.                             }
  6441.                             )(),
  6442.                             templates: {
  6443.                                 tr: TR_TEMPLATE
  6444.                             }
  6445.                         },
  6446.                         templates: {
  6447.                             header: HEADER_TEMPLATE,
  6448.                             footer: FOOTER_TEMPLATE
  6449.                         },
  6450.                         exp: {
  6451.                             title: CONF.LOCALE["export"],
  6452.                             titlePrefix: CONF.LOCALE["export"],
  6453.                             link: CONF.MIDDLE_WARE.export_link,
  6454.                             limit: CONF.MIDDLE_WARE.limit
  6455.                         }
  6456.                     };
  6457.                     if (reportConfig) {
  6458.                         app.deepExtend(this.reportConfig, reportConfig);
  6459.                     }
  6460.                     return this.render();
  6461.                 },
  6462.                 render: function() {
  6463.                     return new (app.ReportTable.extend({
  6464.                         getData: function(backendReports) {
  6465.                             var backendModel = _.values(backendReports.attributes)[0]
  6466.                               , col = new Backbone.Collection()
  6467.                               , response = backendModel.responce;
  6468.                             if (typeof response !== "undefined" && response.attributes) {
  6469.                                 col.reset(response.attributes.backlinks.data);
  6470.                             }
  6471.                             return col;
  6472.                         },
  6473.                         events: {
  6474.                             'click .sem-widget-header-title a': gaClickOnTitle,
  6475.                             'click .sem-report-block-full-report a': gaClickOnButton,
  6476.                             'click .sem-widget-export-link': gaClickOnExport,
  6477.                             'click .backlinks-divlinks a': gaClickOnUrl,
  6478.                             'click .sem-widget-try-again': 'tryAgainHandler'
  6479.                         }
  6480.                     }))(this.reportConfig);
  6481.                 }
  6482.             })
  6483.         }
  6484.         .apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  6485.         __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  6486.     }
  6487.     , function(module, exports) {
  6488.         module.exports = "<tr>\n\t<%= helper.displayBacklinkLinkSource(item.attributes) %>\n\t<%= helper.displayBacklinkAnchorTarget(item.attributes) %>\n\t<%= helper.displayBacklinkType(item.attributes) %>\n</tr>\n"
  6489.     }
  6490.     , function(module, exports, __webpack_require__) {
  6491.         var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  6492.         !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(112), __webpack_require__(72), __webpack_require__(39), __webpack_require__(113), __webpack_require__(15), __webpack_require__(4)],
  6493.         __WEBPACK_AMD_DEFINE_RESULT__ = function(_, TR_TEMPLATE, FOOTER_TEMPLATE, HEADER_TEMPLATE, topojson, countrieslib, Backbone) {
  6494.             "use strict";
  6495.             var getGaWidgetName = function() {
  6496.                 return 'Referring domains'
  6497.             }
  6498.             var gaClickOnTitle = function() {
  6499.                 sendGa('click to title')
  6500.             }
  6501.             var gaClickOnButton = function() {
  6502.                 sendGa('click to button')
  6503.             }
  6504.             var gaClickOnDomain = function() {
  6505.                 sendGa('click to domain')
  6506.             }
  6507.             var gaClickOnExport = function() {
  6508.                 sendGa('click to export')
  6509.             }
  6510.             var sendGa = function(label) {
  6511.                 if (typeof ga === 'undefined')
  6512.                     return;
  6513.                 var action = getGaWidgetName();
  6514.                 ga('send', 'event', 'Domain overview', action, label);
  6515.             }
  6516.             return Backbone.View.extend({
  6517.                 initialize: function(options, reportConfig) {
  6518.                     var CONF = this.CONF = options;
  6519.                     this.reportConfig = {
  6520.                         el: $(CONF.EL),
  6521.                         MIDDLE_WARE: CONF.MIDDLE_WARE,
  6522.                         LOCALE: CONF.LOCALE,
  6523.                         title: CONF.LOCALE.table_title,
  6524.                         title_href: '/analytics/backlinks/refdomains/' + encodeURIComponent(this.CONF.MIDDLE_WARE.target) + ':' + this.CONF.MIDDLE_WARE.target_type,
  6525.                         fullReportLink: '/analytics/backlinks/refdomains/' + encodeURIComponent(this.CONF.MIDDLE_WARE.target) + ':' + this.CONF.MIDDLE_WARE.target_type,
  6526.                         needToLogNothingFound: true,
  6527.                         gaLabel: getGaWidgetName() + ' - Overview',
  6528.                         reports: [{
  6529.                             back: {
  6530.                                 key: app.conf.KEY,
  6531.                                 url: CONF.MIDDLE_WARE.backend_url,
  6532.                                 type: "backlinks_overview",
  6533.                                 method: "nojsonp",
  6534.                                 responceAction: "data",
  6535.                                 target: CONF.MIDDLE_WARE.target,
  6536.                                 target_type: CONF.MIDDLE_WARE.target_type,
  6537.                                 display_hash: CONF.MIDDLE_WARE.display_hash,
  6538.                                 export_columns: CONF.MIDDLE_WARE.export_columns
  6539.                             }
  6540.                         }],
  6541.                         overview: true,
  6542.                         table: {
  6543.                             header: (function() {
  6544.                                 var columns = [];
  6545.                                 columns.push({
  6546.                                     title: CONF.LOCALE.backlink_root_domain
  6547.                                 }, {
  6548.                                     title: CONF.LOCALE.backlink_backlinks_count,
  6549.                                     className: "sem-report-block-table-col-80"
  6550.                                 }, {
  6551.                                     title: CONF.LOCALE.backlink_ip,
  6552.                                     className: "sem-report-block-table-col-120"
  6553.                                 });
  6554.                                 return columns;
  6555.                             }
  6556.                             )(),
  6557.                             templates: {
  6558.                                 tr: TR_TEMPLATE
  6559.                             }
  6560.                         },
  6561.                         templates: {
  6562.                             header: HEADER_TEMPLATE,
  6563.                             footer: FOOTER_TEMPLATE
  6564.                         },
  6565.                         exp: {
  6566.                             title: CONF.LOCALE["export"],
  6567.                             titlePrefix: CONF.LOCALE["export"],
  6568.                             link: CONF.MIDDLE_WARE.export_link,
  6569.                             limit: CONF.MIDDLE_WARE.limit
  6570.                         }
  6571.                     };
  6572.                     if (reportConfig) {
  6573.                         app.deepExtend(this.reportConfig, reportConfig);
  6574.                     }
  6575.                     return this.render();
  6576.                 },
  6577.                 render: function() {
  6578.                     return new (app.ReportTable.extend({
  6579.                         getData: function(backendReports) {
  6580.                             var backendModel = _.values(backendReports.attributes)[0]
  6581.                               , col = new Backbone.Collection()
  6582.                               , response = backendModel.responce;
  6583.                             if (typeof response !== "undefined" && response.attributes) {
  6584.                                 col.reset(response.attributes.refdomains.data);
  6585.                             }
  6586.                             return col;
  6587.                         },
  6588.                         events: {
  6589.                             'click .sem-widget-header-title a': gaClickOnTitle,
  6590.                             'click .sem-widget-content-table a': gaClickOnDomain,
  6591.                             'click .sem-report-block-full-report a': gaClickOnButton,
  6592.                             'click .sem-widget-export-link': gaClickOnExport,
  6593.                             'click .sem-widget-try-again': 'tryAgainHandler'
  6594.                         }
  6595.                     }))(this.reportConfig);
  6596.                 }
  6597.             })
  6598.         }
  6599.         .apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  6600.         __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  6601.     }
  6602.     , function(module, exports) {
  6603.         module.exports = "<tr>\n\t<td data-test-domain-overview-refdomains-item-root-domain><%= helper.displayRefDomainLink(item.get(\"domain\")) %></td>\n\t<td data-test-domain-overview-refdomains-item-backlinks-count><%= helper.breakToThreeComa(item.attributes.backlinks_num) %></td>\n\t<td><span data-test-domain-overview-refdomains-item-country><%= helper.displayCountryFlag(item.attributes.country) %></span> <span data-test-domain-overview-refdomains-item-ip><%= item.attributes.ip %></span></td>\n</tr>\n"
  6604.     }
  6605.     , function(module, exports, __webpack_require__) {
  6606.         var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;
  6607.         !function() {
  6608.             function e(e, n) {
  6609.                 function t(n) {
  6610.                     var t = e.arcs[n]
  6611.                       , r = t[0]
  6612.                       , o = [0, 0];
  6613.                     return t.forEach(function(e) {
  6614.                         o[0] += e[0],
  6615.                         o[1] += e[1]
  6616.                     }),
  6617.                     [r, o]
  6618.                 }
  6619.                 var r = {}
  6620.                   , o = {};
  6621.                 n.forEach(function(e) {
  6622.                     var n, a, i = t(e), u = i[0], c = i[1];
  6623.                     if (n = o[u])
  6624.                         if (delete o[n.end],
  6625.                         n.push(e),
  6626.                         n.end = c,
  6627.                         a = r[c]) {
  6628.                             delete r[a.start];
  6629.                             var f = a === n ? n : n.concat(a);
  6630.                             r[f.start = n.start] = o[f.end = a.end] = f
  6631.                         } else if (a = o[c]) {
  6632.                             delete r[a.start],
  6633.                             delete o[a.end];
  6634.                             var f = n.concat(a.map(function(e) {
  6635.                                 return ~e
  6636.                             }).reverse());
  6637.                             r[f.start = n.start] = o[f.end = a.start] = f
  6638.                         } else
  6639.                             r[n.start] = o[n.end] = n;
  6640.                     else if (n = r[c])
  6641.                         if (delete r[n.start],
  6642.                         n.unshift(e),
  6643.                         n.start = u,
  6644.                         a = o[u]) {
  6645.                             delete o[a.end];
  6646.                             var s = a === n ? n : a.concat(n);
  6647.                             r[s.start = a.start] = o[s.end = n.end] = s
  6648.                         } else if (a = r[u]) {
  6649.                             delete r[a.start],
  6650.                             delete o[a.end];
  6651.                             var s = a.map(function(e) {
  6652.                                 return ~e
  6653.                             }).reverse().concat(n);
  6654.                             r[s.start = a.end] = o[s.end = n.end] = s
  6655.                         } else
  6656.                             r[n.start] = o[n.end] = n;
  6657.                     else if (n = r[u])
  6658.                         if (delete r[n.start],
  6659.                         n.unshift(~e),
  6660.                         n.start = c,
  6661.                         a = o[c]) {
  6662.                             delete o[a.end];
  6663.                             var s = a === n ? n : a.concat(n);
  6664.                             r[s.start = a.start] = o[s.end = n.end] = s
  6665.                         } else if (a = r[c]) {
  6666.                             delete r[a.start],
  6667.                             delete o[a.end];
  6668.                             var s = a.map(function(e) {
  6669.                                 return ~e
  6670.                             }).reverse().concat(n);
  6671.                             r[s.start = a.end] = o[s.end = n.end] = s
  6672.                         } else
  6673.                             r[n.start] = o[n.end] = n;
  6674.                     else if (n = o[c])
  6675.                         if (delete o[n.end],
  6676.                         n.push(~e),
  6677.                         n.end = u,
  6678.                         a = o[u]) {
  6679.                             delete r[a.start];
  6680.                             var f = a === n ? n : n.concat(a);
  6681.                             r[f.start = n.start] = o[f.end = a.end] = f
  6682.                         } else if (a = r[u]) {
  6683.                             delete r[a.start],
  6684.                             delete o[a.end];
  6685.                             var f = n.concat(a.map(function(e) {
  6686.                                 return ~e
  6687.                             }).reverse());
  6688.                             r[f.start = n.start] = o[f.end = a.start] = f
  6689.                         } else
  6690.                             r[n.start] = o[n.end] = n;
  6691.                     else
  6692.                         n = [e],
  6693.                         r[n.start = u] = o[n.end = c] = n
  6694.                 });
  6695.                 var a = [];
  6696.                 for (var i in o)
  6697.                     a.push(o[i]);
  6698.                 return a
  6699.             }
  6700.             function n(n, t, r) {
  6701.                 function a(e) {
  6702.                     0 > e && (e = ~e),
  6703.                     (l[e] || (l[e] = [])).push(s)
  6704.                 }
  6705.                 function i(e) {
  6706.                     e.forEach(a)
  6707.                 }
  6708.                 function u(e) {
  6709.                     e.forEach(i)
  6710.                 }
  6711.                 function c(e) {
  6712.                     "GeometryCollection" === e.type ? e.geometries.forEach(c) : e.type in d && (s = e,
  6713.                     d[e.type](e.arcs))
  6714.                 }
  6715.                 var f = [];
  6716.                 if (arguments.length > 1) {
  6717.                     var s, l = [], d = {
  6718.                         LineString: i,
  6719.                         MultiLineString: u,
  6720.                         Polygon: u,
  6721.                         MultiPolygon: function(e) {
  6722.                             e.forEach(u)
  6723.                         }
  6724.                     };
  6725.                     c(t),
  6726.                     l.forEach(arguments.length < 3 ? function(e, n) {
  6727.                         f.push(n)
  6728.                     }
  6729.                     : function(e, n) {
  6730.                         r(e[0], e[e.length - 1]) && f.push(n)
  6731.                     }
  6732.                     )
  6733.                 } else
  6734.                     for (var p = 0, v = n.arcs.length; v > p; ++p)
  6735.                         f.push(p);
  6736.                 return o(n, {
  6737.                     type: "MultiLineString",
  6738.                     arcs: e(n, f)
  6739.                 })
  6740.             }
  6741.             function t(e, n) {
  6742.                 return "GeometryCollection" === n.type ? {
  6743.                     type: "FeatureCollection",
  6744.                     features: n.geometries.map(function(n) {
  6745.                         return r(e, n)
  6746.                     })
  6747.                 } : r(e, n)
  6748.             }
  6749.             function r(e, n) {
  6750.                 var t = {
  6751.                     type: "Feature",
  6752.                     id: n.id,
  6753.                     properties: n.properties || {},
  6754.                     geometry: o(e, n)
  6755.                 };
  6756.                 return null == n.id && delete t.id,
  6757.                 t
  6758.             }
  6759.             function o(e, n) {
  6760.                 function t(e, n) {
  6761.                     n.length && n.pop();
  6762.                     for (var t, r = s[0 > e ? ~e : e], o = 0, i = r.length; i > o; ++o)
  6763.                         n.push(t = r[o].slice()),
  6764.                         f(t, o);
  6765.                     0 > e && a(n, i)
  6766.                 }
  6767.                 function r(e) {
  6768.                     return e = e.slice(),
  6769.                     f(e, 0),
  6770.                     e
  6771.                 }
  6772.                 function o(e) {
  6773.                     for (var n = [], r = 0, o = e.length; o > r; ++r)
  6774.                         t(e[r], n);
  6775.                     return n.length < 2 && n.push(n[0].slice()),
  6776.                     n
  6777.                 }
  6778.                 function i(e) {
  6779.                     for (var n = o(e); n.length < 4; )
  6780.                         n.push(n[0].slice());
  6781.                     return n
  6782.                 }
  6783.                 function u(e) {
  6784.                     return e.map(i)
  6785.                 }
  6786.                 function c(e) {
  6787.                     var n = e.type;
  6788.                     return "GeometryCollection" === n ? {
  6789.                         type: n,
  6790.                         geometries: e.geometries.map(c)
  6791.                     } : n in l ? {
  6792.                         type: n,
  6793.                         coordinates: l[n](e)
  6794.                     } : null
  6795.                 }
  6796.                 var f = d(e.transform)
  6797.                   , s = e.arcs
  6798.                   , l = {
  6799.                     Point: function(e) {
  6800.                         return r(e.coordinates)
  6801.                     },
  6802.                     MultiPoint: function(e) {
  6803.                         return e.coordinates.map(r)
  6804.                     },
  6805.                     LineString: function(e) {
  6806.                         return o(e.arcs)
  6807.                     },
  6808.                     MultiLineString: function(e) {
  6809.                         return e.arcs.map(o)
  6810.                     },
  6811.                     Polygon: function(e) {
  6812.                         return u(e.arcs)
  6813.                     },
  6814.                     MultiPolygon: function(e) {
  6815.                         return e.arcs.map(u)
  6816.                     }
  6817.                 };
  6818.                 return c(n)
  6819.             }
  6820.             function a(e, n) {
  6821.                 for (var t, r = e.length, o = r - n; o < --r; )
  6822.                     t = e[o],
  6823.                     e[o++] = e[r],
  6824.                     e[r] = t
  6825.             }
  6826.             function i(e, n) {
  6827.                 for (var t = 0, r = e.length; r > t; ) {
  6828.                     var o = t + r >>> 1;
  6829.                     e[o] < n ? t = o + 1 : r = o
  6830.                 }
  6831.                 return t
  6832.             }
  6833.             function u(e) {
  6834.                 function n(e, n) {
  6835.                     e.forEach(function(e) {
  6836.                         0 > e && (e = ~e);
  6837.                         var t = o[e];
  6838.                         t ? t.push(n) : o[e] = [n]
  6839.                     })
  6840.                 }
  6841.                 function t(e, t) {
  6842.                     e.forEach(function(e) {
  6843.                         n(e, t)
  6844.                     })
  6845.                 }
  6846.                 function r(e, n) {
  6847.                     "GeometryCollection" === e.type ? e.geometries.forEach(function(e) {
  6848.                         r(e, n)
  6849.                     }) : e.type in u && u[e.type](e.arcs, n)
  6850.                 }
  6851.                 var o = {}
  6852.                   , a = e.map(function() {
  6853.                     return []
  6854.                 })
  6855.                   , u = {
  6856.                     LineString: n,
  6857.                     MultiLineString: t,
  6858.                     Polygon: t,
  6859.                     MultiPolygon: function(e, n) {
  6860.                         e.forEach(function(e) {
  6861.                             t(e, n)
  6862.                         })
  6863.                     }
  6864.                 };
  6865.                 e.forEach(r);
  6866.                 for (var c in o)
  6867.                     for (var f = o[c], s = f.length, l = 0; s > l; ++l)
  6868.                         for (var d = l + 1; s > d; ++d) {
  6869.                             var p, v = f[l], h = f[d];
  6870.                             (p = a[v])[c = i(p, h)] !== h && p.splice(c, 0, h),
  6871.                             (p = a[h])[c = i(p, v)] !== v && p.splice(c, 0, v)
  6872.                         }
  6873.                 return a
  6874.             }
  6875.             function c(e, n) {
  6876.                 function t(e) {
  6877.                     i.remove(e),
  6878.                     e[1][2] = n(e),
  6879.                     i.push(e)
  6880.                 }
  6881.                 var r, o = d(e.transform), a = p(e.transform), i = l(s), u = 0;
  6882.                 for (n || (n = f),
  6883.                 e.arcs.forEach(function(e) {
  6884.                     var t = [];
  6885.                     e.forEach(o);
  6886.                     for (var a = 1, u = e.length - 1; u > a; ++a)
  6887.                         r = e.slice(a - 1, a + 2),
  6888.                         r[1][2] = n(r),
  6889.                         t.push(r),
  6890.                         i.push(r);
  6891.                     e[0][2] = e[u][2] = 1 / 0;
  6892.                     for (var a = 0, u = t.length; u > a; ++a)
  6893.                         r = t[a],
  6894.                         r.previous = t[a - 1],
  6895.                         r.next = t[a + 1]
  6896.                 }); r = i.pop(); ) {
  6897.                     var c = r.previous
  6898.                       , v = r.next;
  6899.                     r[1][2] < u ? r[1][2] = u : u = r[1][2],
  6900.                     c && (c.next = v,
  6901.                     c[2] = r[2],
  6902.                     t(c)),
  6903.                     v && (v.previous = c,
  6904.                     v[0] = r[0],
  6905.                     t(v))
  6906.                 }
  6907.                 return e.arcs.forEach(function(e) {
  6908.                     e.forEach(a)
  6909.                 }),
  6910.                 e
  6911.             }
  6912.             function f(e) {
  6913.                 return Math.abs((e[0][0] - e[2][0]) * (e[1][1] - e[0][1]) - (e[0][0] - e[1][0]) * (e[2][1] - e[0][1]))
  6914.             }
  6915.             function s(e, n) {
  6916.                 return e[1][2] - n[1][2]
  6917.             }
  6918.             function l(e) {
  6919.                 function n(n) {
  6920.                     for (var t = o[n]; n > 0; ) {
  6921.                         var r = (n + 1 >> 1) - 1
  6922.                           , a = o[r];
  6923.                         if (e(t, a) >= 0)
  6924.                             break;
  6925.                         o[a.index = n] = a,
  6926.                         o[t.index = n = r] = t
  6927.                     }
  6928.                 }
  6929.                 function t(n) {
  6930.                     for (var t = o[n]; ; ) {
  6931.                         var r = n + 1 << 1
  6932.                           , a = r - 1
  6933.                           , i = n
  6934.                           , u = o[i];
  6935.                         if (a < o.length && e(o[a], u) < 0 && (u = o[i = a]),
  6936.                         r < o.length && e(o[r], u) < 0 && (u = o[i = r]),
  6937.                         i === n)
  6938.                             break;
  6939.                         o[u.index = n] = u,
  6940.                         o[t.index = n = i] = t
  6941.                     }
  6942.                 }
  6943.                 var r = {}
  6944.                   , o = [];
  6945.                 return r.push = function() {
  6946.                     for (var e = 0, t = arguments.length; t > e; ++e) {
  6947.                         var r = arguments[e];
  6948.                         n(r.index = o.push(r) - 1)
  6949.                     }
  6950.                     return o.length
  6951.                 }
  6952.                 ,
  6953.                 r.pop = function() {
  6954.                     var e = o[0]
  6955.                       , n = o.pop();
  6956.                     return o.length && (o[n.index = 0] = n,
  6957.                     t(0)),
  6958.                     e
  6959.                 }
  6960.                 ,
  6961.                 r.remove = function(r) {
  6962.                     var a = r.index
  6963.                       , i = o.pop();
  6964.                     return a !== o.length && (o[i.index = a] = i,
  6965.                     (e(i, r) < 0 ? n : t)(a)),
  6966.                     a
  6967.                 }
  6968.                 ,
  6969.                 r
  6970.             }
  6971.             function d(e) {
  6972.                 if (!e)
  6973.                     return v;
  6974.                 var n, t, r = e.scale[0], o = e.scale[1], a = e.translate[0], i = e.translate[1];
  6975.                 return function(e, u) {
  6976.                     u || (n = t = 0),
  6977.                     e[0] = (n += e[0]) * r + a,
  6978.                     e[1] = (t += e[1]) * o + i
  6979.                 }
  6980.             }
  6981.             function p(e) {
  6982.                 if (!e)
  6983.                     return v;
  6984.                 var n, t, r = e.scale[0], o = e.scale[1], a = e.translate[0], i = e.translate[1];
  6985.                 return function(e, u) {
  6986.                     u || (n = t = 0);
  6987.                     var c = 0 | (e[0] - a) / r
  6988.                       , f = 0 | (e[1] - i) / o;
  6989.                     e[0] = c - n,
  6990.                     e[1] = f - t,
  6991.                     n = c,
  6992.                     t = f
  6993.                 }
  6994.             }
  6995.             function v() {}
  6996.             var h = {
  6997.                 version: "1.4.6",
  6998.                 mesh: n,
  6999.                 feature: t,
  7000.                 neighbors: u,
  7001.                 presimplify: c
  7002.             };
  7003.             true ? !(__WEBPACK_AMD_DEFINE_FACTORY__ = (h),
  7004.             __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  7005.             __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : "object" == typeof module && module.exports ? module.exports = h : this.topojson = h
  7006.         }();
  7007.     }
  7008.     , function(module, exports, __webpack_require__) {
  7009.         var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  7010.         !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(115), __webpack_require__(72), __webpack_require__(39), __webpack_require__(4)],
  7011.         __WEBPACK_AMD_DEFINE_RESULT__ = function(_, TR_TEMPLATE, FOOTER_TEMPLATE, HEADER_TEMPLATE, Backbone) {
  7012.             "use strict";
  7013.             var getGaWidgetName = function() {
  7014.                 return 'Indexed pages'
  7015.             }
  7016.             var gaClickOnTitle = function() {
  7017.                 sendGa('click to title')
  7018.             }
  7019.             var gaClickOnButton = function() {
  7020.                 sendGa('click to button')
  7021.             }
  7022.             var gaClickOnPage = function() {
  7023.                 sendGa('click to page')
  7024.             }
  7025.             var gaClickOnExport = function() {
  7026.                 sendGa('click to export')
  7027.             }
  7028.             var sendGa = function(label) {
  7029.                 if (typeof ga === 'undefined')
  7030.                     return;
  7031.                 var action = getGaWidgetName();
  7032.                 ga('send', 'event', 'Domain overview', action, label);
  7033.             }
  7034.             return Backbone.View.extend({
  7035.                 initialize: function(options, reportConfig) {
  7036.                     var CONF = this.CONF = options;
  7037.                     this.reportConfig = {
  7038.                         el: $(CONF.EL),
  7039.                         MIDDLE_WARE: CONF.MIDDLE_WARE,
  7040.                         LOCALE: CONF.LOCALE,
  7041.                         title: CONF.LOCALE.table_title,
  7042.                         title_href: '/analytics/backlinks/pages/' + encodeURIComponent(this.CONF.MIDDLE_WARE.target) + ':' + this.CONF.MIDDLE_WARE.target_type,
  7043.                         fullReportLink: '/analytics/backlinks/pages/' + encodeURIComponent(this.CONF.MIDDLE_WARE.target) + ':' + this.CONF.MIDDLE_WARE.target_type,
  7044.                         needToLogNothingFound: true,
  7045.                         gaLabel: getGaWidgetName() + ' - Overview',
  7046.                         reports: [{
  7047.                             back: (function() {
  7048.                                 var foo = {
  7049.                                     key: app.conf.KEY,
  7050.                                     url: CONF.MIDDLE_WARE.backend_url,
  7051.                                     type: "backlinks_overview",
  7052.                                     method: "nojsonp",
  7053.                                     responceAction: "data",
  7054.                                     target: CONF.MIDDLE_WARE.target,
  7055.                                     target_type: CONF.MIDDLE_WARE.target_type,
  7056.                                     display_hash: CONF.MIDDLE_WARE.display_hash,
  7057.                                     export_columns: CONF.MIDDLE_WARE.export_columns
  7058.                                 };
  7059.                                 return foo;
  7060.                             }
  7061.                             )()
  7062.                         }],
  7063.                         overview: true,
  7064.                         table: {
  7065.                             header: (function() {
  7066.                                 var columns = [];
  7067.                                 columns.push({
  7068.                                     title: CONF.LOCALE.backlinks_pages_link
  7069.                                 }, {
  7070.                                     title: CONF.LOCALE.backlinks_pages_domains_count,
  7071.                                     className: "sem-report-block-table-col-80"
  7072.                                 }, {
  7073.                                     title: CONF.LOCALE.backlink_backlinks_count,
  7074.                                     className: "sem-report-block-table-col-80"
  7075.                                 });
  7076.                                 return columns;
  7077.                             }
  7078.                             )(),
  7079.                             templates: {
  7080.                                 tr: TR_TEMPLATE
  7081.                             }
  7082.                         },
  7083.                         templates: {
  7084.                             header: HEADER_TEMPLATE,
  7085.                             footer: FOOTER_TEMPLATE
  7086.                         },
  7087.                         exp: {
  7088.                             title: CONF.LOCALE["export"],
  7089.                             titlePrefix: CONF.LOCALE["export"],
  7090.                             link: CONF.MIDDLE_WARE.export_link,
  7091.                             limit: CONF.MIDDLE_WARE.limit
  7092.                         }
  7093.                     };
  7094.                     if (reportConfig) {
  7095.                         app.deepExtend(this.reportConfig, reportConfig);
  7096.                     }
  7097.                     return this.render();
  7098.                 },
  7099.                 render: function() {
  7100.                     return new (app.ReportTable.extend({
  7101.                         getData: function(backendReports) {
  7102.                             var backendModel = _.values(backendReports.attributes)[0]
  7103.                               , col = new Backbone.Collection()
  7104.                               , response = backendModel.responce;
  7105.                             if (typeof response !== "undefined" && response.attributes) {
  7106.                                 col.reset(response.attributes.pages.data);
  7107.                             }
  7108.                             return col;
  7109.                         },
  7110.                         events: {
  7111.                             'click .sem-widget-header-title a': gaClickOnTitle,
  7112.                             'click .backlinks-divlinks a': gaClickOnPage,
  7113.                             'click .sem-report-block-full-report a': gaClickOnButton,
  7114.                             'click .sem-widget-export-link': gaClickOnExport,
  7115.                             'click .sem-widget-try-again': 'tryAgainHandler'
  7116.                         }
  7117.                     }))(this.reportConfig);
  7118.                 }
  7119.             });
  7120.         }
  7121.         .apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  7122.         __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  7123.     }
  7124.     , function(module, exports) {
  7125.         module.exports = "<tr>\n    <%= helper.displayBacklinksPagesLink(item.attributes) %>\n    <td class=\"right\">\n\t\t<span data-test-domain-overview-pages-item-domains-count>\n\t\t<% if (item.attributes.source_url.length > 0 && item.attributes.domains_num > 0) { %>\n\t\t\t<a href=\"/analytics/backlinks/refdomains/<%- encodeURIComponent(item.attributes.source_url)%>:url\">\n\t\t\t\t<%= helper.breakToThreeComa(item.attributes.domains_num) %>\n\t\t\t</a>\n\t\t<% } else { %>\n\t\t\t<%= helper.breakToThreeComa(item.attributes.domains_num) %>\n\t\t<% } %>\n\t\t</span>\n    </td>\n    <td class=\"right\">\n\t\t<span data-test-domain-overview-pages-item-backlinks-count>\n        <% if (item.attributes.source_url.length > 0 && item.attributes.backlinks_num > 0 ) { %>\n\t        <a href=\"/analytics/backlinks/backlinks/<%- encodeURIComponent(item.attributes.source_url)%>:url\">\n\t            <%= helper.breakToThreeComa(item.attributes.backlinks_num) %>\n\t        </a>\n        <% } else { %>\n            <%= helper.breakToThreeComa(item.attributes.backlinks_num) %>\n        <% } %>\n\t\t</span>\n    </td>\n</tr>\n"
  7126.     }
  7127.     , function(module, exports, __webpack_require__) {
  7128.         var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  7129.         !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(117), __webpack_require__(72), __webpack_require__(39), __webpack_require__(4), __webpack_require__(5)],
  7130.         __WEBPACK_AMD_DEFINE_RESULT__ = function(_, TR_TEMPLATE, FOOTER_TEMPLATE, HEADER_TEMPLATE, Backbone) {
  7131.             "use strict";
  7132.             var getGaWidgetName = function() {
  7133.                 return 'Latest publishers'
  7134.             }
  7135.             var gaClickOnTitle = function() {
  7136.                 sendGa('click to title')
  7137.             }
  7138.             var gaClickOnExport = function() {
  7139.                 sendGa('click to export')
  7140.             }
  7141.             var gaClickOnUrl = function() {
  7142.                 sendGa('click to url')
  7143.             }
  7144.             var gaClickOnDomain = function() {
  7145.                 sendGa('click to domain')
  7146.             }
  7147.             var gaClickOnNumAds = function() {
  7148.                 sendGa('click to number of ads')
  7149.             }
  7150.             var gaClickOnPercentText = function() {
  7151.                 sendGa('click to percent of text')
  7152.             }
  7153.             var gaClickOnPercentImage = function() {
  7154.                 sendGa('click to percent of image')
  7155.             }
  7156.             var gaClickOnButton = function() {
  7157.                 sendGa('click to button')
  7158.             }
  7159.             var sendGa = function(label) {
  7160.                 if (typeof ga === 'undefined')
  7161.                     return;
  7162.                 var action = getGaWidgetName();
  7163.                 ga('send', 'event', 'Domain overview', action, label);
  7164.             }
  7165.             return Backbone.View.extend({
  7166.                 initialize: function(options, reportConfig) {
  7167.                     var CONF = this.CONF = options;
  7168.                     var isPublisher = reportConfig.domainType === "publisher";
  7169.                     var linkToSpa = (isPublisher) ? ("/analytics/da/advertisers/" + CONF.MIDDLE_WARE.domain_id) : ("/analytics/da/publishers/" + CONF.MIDDLE_WARE.domain_id);
  7170.                     this.reportConfig = {
  7171.                         el: $(CONF.EL),
  7172.                         title: isPublisher ? CONF.LOCALE.adv_title : CONF.LOCALE.pub_title,
  7173.                         tooltip: isPublisher ? CONF.LOCALE.adv_title : CONF.LOCALE.pub_title,
  7174.                         title_href: linkToSpa,
  7175.                         MIDDLE_WARE: CONF.MIDDLE_WARE,
  7176.                         LOCALE: CONF.LOCALE,
  7177.                         fullReportLink: linkToSpa,
  7178.                         needToLogNothingFound: true,
  7179.                         gaLabel: getGaWidgetName() + ' - Overview',
  7180.                         reports: [{
  7181.                             back: {
  7182.                                 type: "latest"
  7183.                             }
  7184.                         }],
  7185.                         overview: true,
  7186.                         templates: {
  7187.                             header: HEADER_TEMPLATE,
  7188.                             footer: FOOTER_TEMPLATE
  7189.                         },
  7190.                         exp: {
  7191.                             title: CONF.LOCALE["export"],
  7192.                             titlePrefix: CONF.LOCALE["export"],
  7193.                             link: isPublisher ? CONF.MIDDLE_WARE.adv_link : CONF.MIDDLE_WARE.pub_link
  7194.                         },
  7195.                         table: {
  7196.                             header: [{
  7197.                                 title: isPublisher ? CONF.LOCALE.adv_title : CONF.LOCALE.pub_title
  7198.                             }, {
  7199.                                 title: CONF.LOCALE.ads_adverts_count_title,
  7200.                                 className: "sem-report-block-table-col-40"
  7201.                             }, {
  7202.                                 title: CONF.LOCALE.ads_textmedia,
  7203.                                 className: "sem-widget-cell-to-center minimized"
  7204.                             }],
  7205.                             templates: {
  7206.                                 tr: TR_TEMPLATE
  7207.                             }
  7208.                         }
  7209.                     };
  7210.                     if (reportConfig) {
  7211.                         app.deepExtend(this.reportConfig, reportConfig);
  7212.                     }
  7213.                     return this.render();
  7214.                 },
  7215.                 render: function() {
  7216.                     return new (app.ReportTable.extend({
  7217.                         events: {
  7218.                             'click .sem-widget-header-title a': gaClickOnTitle,
  7219.                             'click .sem-report-block-full-report a': gaClickOnButton,
  7220.                             'click .sem-widget-export-link': gaClickOnExport,
  7221.                             'click .sem-widget-url-img': gaClickOnUrl,
  7222.                             'click .da-table-num-ads': gaClickOnNumAds,
  7223.                             'click .sem-asns-text-media-container .sem-asns-text-media-left a': gaClickOnPercentText,
  7224.                             'click .sem-asns-text-media-container .sem-asns-text-media-right a': gaClickOnPercentImage,
  7225.                             'click .sem-widget-url-cell': gaClickOnDomain,
  7226.                             'click .sem-widget-try-again': 'tryAgainHandler'
  7227.                         },
  7228.                         nothingFoundEl: ".sem-widget-content",
  7229.                         afterRender: function() {
  7230.                             app.ReportTable.prototype.afterRender.apply(this, arguments);
  7231.                         }
  7232.                     }))(this.reportConfig);
  7233.                 }
  7234.             });
  7235.         }
  7236.         .apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  7237.         __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  7238.     }
  7239.     , function(module, exports) {
  7240.         module.exports = "<tr>\n\t<%= helper.dispDom(item.get(\"domain\"), 0, 1) %>\n\t<%= helper.dispAdsColNumOfAds(MIDDLE_WARE.domain_id, item.get('domain'), item.get('adsCount'), item.get('textAdsCount'), item.get('mediaAdsCount'), LOCALE.ads_title_go_to_adv_pub_rep, LOCALE.ads_title_go_to_adv_pub_rep_text_ads, LOCALE.ads_title_go_to_adv_pub_rep_media_ads, \"\", \"sem-widget-cell-to-right\") %>\n\n\t<td>\n\t\t<%=\n\t\thelper.adsTextmediaBar1(100,\n\t\t\tMIDDLE_WARE.domain_id,\n\t\t\titem.get('domain'),\n\t\t\t\"by+adsense_advertiser_publisher\",\n\t\t\titem.get('adsCount'),\n\t\t\titem.get('textAdsCount'),\n\t\t\titem.get('mediaAdsCount'),\n\t\t\tLOCALE.ads_title_go_to_adv_pub_rep_text_ads,\n\t\t\tLOCALE.ads_title_go_to_adv_pub_rep_media_ads\n\t\t) %>\n\t</td>\n</tr>\n"
  7241.     }
  7242.     , function(module, exports, __webpack_require__) {
  7243.         var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  7244.         !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(119), __webpack_require__(72), __webpack_require__(39), __webpack_require__(4), __webpack_require__(5)],
  7245.         __WEBPACK_AMD_DEFINE_RESULT__ = function(_, TR_TEMPLATE, FOOTER_TEMPLATE, HEADER_TEMPLATE, Backbone) {
  7246.             "use strict";
  7247.             var getGaWidgetName = function() {
  7248.                 return 'Landing pages'
  7249.             }
  7250.             var gaClickOnTitle = function() {
  7251.                 sendGa('click to title')
  7252.             }
  7253.             var gaClickOnUrl = function() {
  7254.                 sendGa('click to url')
  7255.             }
  7256.             var gaClickOnButton = function() {
  7257.                 sendGa('click to button')
  7258.             }
  7259.             var sendGa = function(label) {
  7260.                 if (typeof ga === 'undefined')
  7261.                     return;
  7262.                 ga('send', 'event', 'Domain overview', getGaWidgetName(), label);
  7263.             }
  7264.             return Backbone.View.extend({
  7265.                 initialize: function(options, reportConfig) {
  7266.                     var CONF = this.CONF = options;
  7267.                     var isPublisher = reportConfig.domainType === "publisher";
  7268.                     this.reportConfig = {
  7269.                         el: $(CONF.EL),
  7270.                         title: CONF.LOCALE.title,
  7271.                         tooltip: CONF.LOCALE.title_tooltip,
  7272.                         MIDDLE_WARE: CONF.MIDDLE_WARE,
  7273.                         LOCALE: CONF.LOCALE,
  7274.                         needToLogNothingFound: true,
  7275.                         gaLabel: getGaWidgetName() + ' - Overview',
  7276.                         reports: [{
  7277.                             back: {
  7278.                                 type: "landings"
  7279.                             }
  7280.                         }],
  7281.                         overview: true,
  7282.                         templates: {
  7283.                             header: HEADER_TEMPLATE,
  7284.                             footer: FOOTER_TEMPLATE
  7285.                         },
  7286.                         table: {
  7287.                             header: [{
  7288.                                 title: CONF.LOCALE.ads_landing_title
  7289.                             }, {
  7290.                                 title: CONF.LOCALE.ads_times_seen_title,
  7291.                                 className: "sem-report-block-table-col-40"
  7292.                             }],
  7293.                             templates: {
  7294.                                 tr: TR_TEMPLATE
  7295.                             }
  7296.                         }
  7297.                     };
  7298.                     if (!isPublisher) {
  7299.                         this.reportConfig.title_href = "/analytics/da/landings/" + CONF.MIDDLE_WARE.domain_id;
  7300.                         this.reportConfig.fullReportLink = "/analytics/da/landings/" + CONF.MIDDLE_WARE.domain_id;
  7301.                     }
  7302.                     if (reportConfig) {
  7303.                         app.deepExtend(this.reportConfig, reportConfig);
  7304.                     }
  7305.                     return this.render();
  7306.                 },
  7307.                 render: function() {
  7308.                     return new (app.ReportTable.extend({
  7309.                         nothingFoundEl: ".sem-widget-content",
  7310.                         events: {
  7311.                             'click .sem-widget-header-title a': gaClickOnTitle,
  7312.                             'click .sem-report-block-full-report a': gaClickOnButton,
  7313.                             'click .sem-widget-url-img': gaClickOnUrl,
  7314.                             'click .sem-widget-try-again': 'tryAgainHandler'
  7315.                         },
  7316.                         afterRender: function() {
  7317.                             app.ReportTable.prototype.afterRender.apply(this, arguments);
  7318.                         }
  7319.                     }))(this.reportConfig);
  7320.                 }
  7321.             });
  7322.         }
  7323.         .apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  7324.         __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  7325.     }
  7326.     , function(module, exports) {
  7327.         module.exports = "<tr>\n\t<%= helper.dispAdsLandings(item.get(\"targetUrl\")) %>\n\t<td><%= helper.breakToThreeComa(item.get(\"timesSeen\")) %></td>\n</tr>\n"
  7328.     }
  7329.     , function(module, exports, __webpack_require__) {
  7330.         var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  7331.         !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(121), __webpack_require__(122), __webpack_require__(72), __webpack_require__(39), __webpack_require__(4), __webpack_require__(5)],
  7332.         __WEBPACK_AMD_DEFINE_RESULT__ = function(_, TEXT_TR_TEMPLATE, MEDIA_TR_TEMPLATE, FOOTER_TEMPLATE, HEADER_TEMPLATE, Backbone) {
  7333.             "use strict";
  7334.             var gaClickOnTitle = function(kind) {
  7335.                 sendGa(kind, 'click to title')
  7336.             }
  7337.             var gaClickOnExport = function(kind) {
  7338.                 sendGa(kind, 'click to export')
  7339.             }
  7340.             var gaClickOnSample = function(kind) {
  7341.                 if (kind === 'text') {
  7342.                     sendGa(kind, 'click to sample');
  7343.                 } else {
  7344.                     gaClickOnImage(kind);
  7345.                 }
  7346.             }
  7347.             var gaClickOnButton = function(kind) {
  7348.                 sendGa(kind, 'click to button')
  7349.             }
  7350.             var gaClickOnImage = function(kind) {
  7351.                 sendGa(kind, 'click to image')
  7352.             }
  7353.             var sendGa = function(kind, label) {
  7354.                 if (typeof ga === 'undefined')
  7355.                     return;
  7356.                 var action = kind == 'text' ? 'Sample text ads' : 'Sample image ads';
  7357.                 ga('send', 'event', 'Domain overview', action, label);
  7358.             }
  7359.             return Backbone.View.extend({
  7360.                 initialize: function(options, reportConfig) {
  7361.                     var CONF = this.CONF = options;
  7362.                     var isPublisher = reportConfig.domainType === "publisher";
  7363.                     var kind = (CONF.MIDDLE_WARE.ads_kind == 'text' ? '_textAds' : 'mediaAds');
  7364.                     var linkToSpa = "/analytics/da/creatives/" + CONF.MIDDLE_WARE.domain_id + "?detailedName=" + kind + '&platformName=' + (isPublisher ? 'asPublisher' : 'asAdvertiser');
  7365.                     this.reportConfig = {
  7366.                         el: $(CONF.EL),
  7367.                         title: CONF.LOCALE.title,
  7368.                         tooltip: CONF.LOCALE.title_tooltip,
  7369.                         title_href: linkToSpa,
  7370.                         MIDDLE_WARE: CONF.MIDDLE_WARE,
  7371.                         LOCALE: CONF.LOCALE,
  7372.                         fullReportLink: linkToSpa,
  7373.                         needToLogNothingFound: true,
  7374.                         reports: [{
  7375.                             back: {
  7376.                                 type: CONF.MIDDLE_WARE.ads_kind
  7377.                             }
  7378.                         }],
  7379.                         exp: (CONF.MIDDLE_WARE.ads_kind == 'text') ? {
  7380.                             title: CONF.LOCALE["export"],
  7381.                             titlePrefix: CONF.LOCALE["export"],
  7382.                             link: isPublisher ? CONF.MIDDLE_WARE.adv_link : CONF.MIDDLE_WARE.pub_link
  7383.                         } : undefined,
  7384.                         templates: {
  7385.                             header: HEADER_TEMPLATE,
  7386.                             footer: FOOTER_TEMPLATE
  7387.                         },
  7388.                         table: {
  7389.                             templates: {
  7390.                                 data: function() {
  7391.                                     return "<% if (typeof data !== \"undefined\" && data.length) { %>" + "<tr class=\"sem-widget-overview-info\">" + "<% data.each(function(item, countTr) { %>" + "<% if (countTr < 4) { %>" + this.template("tr") + "<% } %>" + "<% if (countTr < 3) { %>" + "<td><div style=\"width: 27px; display: block;\"></div></td>" + "<% } %>" + "<% }); %>" + "</tr>" + "<% } else { %>" + "<td<% if (typeof header !== \"undefined\" && header.length) { %>" + "colspan=\"<%= header.length %>\"<% } %> class=\"sem-widgets-no-results\"" + ">" + this.template("nothingFound") + "</td>" + "<% } %>";
  7392.                                 },
  7393.                                 tr: (CONF.MIDDLE_WARE.ads_kind == 'text') ? TEXT_TR_TEMPLATE : MEDIA_TR_TEMPLATE
  7394.                             }
  7395.                         },
  7396.                         reportLimit: 1,
  7397.                         overview: true,
  7398.                         getData: function(backendData) {
  7399.                             _.each(backendData.toJSON(), function(model) {
  7400.                                 if (model.length != 0) {
  7401.                                     var mds;
  7402.                                     mds = model.models.slice(0, 4);
  7403.                                     _.map(mds, function(i, index) {
  7404.                                         i.set('spa_url', linkToSpa + '&item=' + index);
  7405.                                     });
  7406.                                     model.models = mds;
  7407.                                     model.length = mds.length;
  7408.                                 }
  7409.                             });
  7410.                             return app.ReportTable.prototype.getData.apply(this, arguments);
  7411.                         }
  7412.                     };
  7413.                     if (reportConfig) {
  7414.                         app.deepExtend(this.reportConfig, reportConfig);
  7415.                     }
  7416.                     return this.render();
  7417.                 },
  7418.                 render: function() {
  7419.                     var CONF = this.CONF;
  7420.                     return new (app.ReportTable.extend({
  7421.                         events: {
  7422.                             'click .sem-widget-header-title a': function() {
  7423.                                 gaClickOnTitle(CONF.MIDDLE_WARE.ads_kind)
  7424.                             },
  7425.                             'click .sem-report-block-full-report a': function() {
  7426.                                 gaClickOnButton(CONF.MIDDLE_WARE.ads_kind)
  7427.                             },
  7428.                             'click .sem-widget-export-link': function() {
  7429.                                 gaClickOnExport(CONF.MIDDLE_WARE.ads_kind)
  7430.                             },
  7431.                             'click .sem-widget-overview-info a': function() {
  7432.                                 gaClickOnSample(CONF.MIDDLE_WARE.ads_kind)
  7433.                             },
  7434.                             'click .sem-widget-try-again': 'tryAgainHandler'
  7435.                         }
  7436.                     }))(this.reportConfig);
  7437.                 }
  7438.             });
  7439.         }
  7440.         .apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  7441.         __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  7442.     }
  7443.     , function(module, exports) {
  7444.         module.exports = "<td>\n\t<a href='<%= item.get(\"spa_url\") %>' target=\"_blank\" rel=\"nofollow noopener noreferrer\">\n\t   <%= item.get(\"title\").replace(/<\\/a>.+/i, \"\") %>\n\t</a>\n\t<% if (item.get(\"visibleUrl\")) { %>\n\t<div class=\"sem-widget-type-ads-domain\" title=\"<%= item.get(\"Vu\") %>\"><span class=\"sem-report-block-ad\">Ad</span><%= item.get(\"visibleUrl\") %></div>\n\t<% } %>\n\t<div><%= item.get(\"text\")%></div>\n</td>"
  7445.     }
  7446.     , function(module, exports) {
  7447.         module.exports = "<td class=\"sem-report-block-adsense-media-td\">\n    <a class=\"sem-report-block-adsense-media-ad\"\n       href='<%= item.get(\"spa_url\") %>'\n       target=\"_blank\" rel=\"nofollow noopener noreferrer\">\n        <div><img src=\"<%= item.get('mediaUrl') %>\"/></div>\n    </a>\n</td>"
  7448.     }
  7449.     , function(module, exports, __webpack_require__) {
  7450.         var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  7451.         !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(39), __webpack_require__(78), __webpack_require__(4), __webpack_require__(5)],
  7452.         __WEBPACK_AMD_DEFINE_RESULT__ = function(_, HEADER_TEMPLATE, NOTHING_FOUND_TEMPLATE, Backbone) {
  7453.             "use strict";
  7454.             var getGaWidgetName = function() {
  7455.                 return 'Branded search'
  7456.             }
  7457.             var gaClickOnChart = function(type) {
  7458.                 sendGa('click to pie chart - ' + type);
  7459.             }
  7460.             var sendGa = function(label) {
  7461.                 var action = getGaWidgetName();
  7462.                 if (typeof ga !== 'undefined') {
  7463.                     ga('send', 'event', 'Domain overview', action, label);
  7464.                 }
  7465.             }
  7466.             return Backbone.View.extend({
  7467.                 initialize: function(options, reportConfig) {
  7468.                     var CONF = this.CONF = options
  7469.                       , _this = this;
  7470.                     this.reportConfig = {
  7471.                         el: $(CONF.EL),
  7472.                         title: CONF.LOCALE.title,
  7473.                         tooltip: CONF.LOCALE.title_tooltip,
  7474.                         MIDDLE_WARE: CONF.MIDDLE_WARE,
  7475.                         LOCALE: CONF.LOCALE,
  7476.                         needToLogNothingFound: true,
  7477.                         gaLabel: getGaWidgetName() + ' - Overview',
  7478.                         reports: [{
  7479.                             back: (function() {
  7480.                                 var foo = {
  7481.                                     key: app.conf.KEY,
  7482.                                     domain: CONF.MIDDLE_WARE.domain_id,
  7483.                                     url: CONF.MIDDLE_WARE.backend_url,
  7484.                                     action: "report",
  7485.                                     type: "domain_rank",
  7486.                                     responceAction: "rank"
  7487.                                 };
  7488.                                 if (CONF.MIDDLE_WARE.exportHash) {
  7489.                                     foo.display_hash = CONF.MIDDLE_WARE.exportHash;
  7490.                                 }
  7491.                                 if (CONF.MIDDLE_WARE.current_db_date != 'current') {
  7492.                                     foo.display_date = CONF.MIDDLE_WARE.current_db_date + '15';
  7493.                                 }
  7494.                                 return foo;
  7495.                             }
  7496.                             )()
  7497.                         }],
  7498.                         chartOptions: {
  7499.                             chart: {
  7500.                                 type: "pie",
  7501.                                 spacingTop: 0,
  7502.                                 spacingLeft: 0,
  7503.                                 spacingRight: 0,
  7504.                                 spacingBottom: 0,
  7505.                                 height: 100
  7506.                             },
  7507.                             series: [{
  7508.                                 size: '100%',
  7509.                                 innerSize: '70%'
  7510.                             }],
  7511.                             legend: {
  7512.                                 useHTML: true,
  7513.                                 labelFormatter: function() {
  7514.                                     return '<div class="sem-report-legend-item index-' + this.index + '"><strong>' + this.percentage.toFixed(2) + '%</strong><br/>' + this.name + '</div>';
  7515.                                 },
  7516.                                 itemMarginBottom: 5,
  7517.                                 verticalAlign: "top",
  7518.                                 borderWidth: 0,
  7519.                                 symbolWidth: 0,
  7520.                                 floating: false,
  7521.                                 padding: 0,
  7522.                                 layout: "vertical",
  7523.                                 align: "right",
  7524.                                 margin: 0,
  7525.                                 itemStyle: {
  7526.                                     fontSize: '12px',
  7527.                                     fontWeight: 'normal'
  7528.                                 },
  7529.                                 navigation: {
  7530.                                     enabled: false
  7531.                                 }
  7532.                             },
  7533.                             plotOptions: {
  7534.                                 pie: {
  7535.                                     center: ['50%', '50%'],
  7536.                                     ignoreHiddenPoint: true,
  7537.                                     showInLegend: true,
  7538.                                     slicedOffset: 0,
  7539.                                     shadow: false,
  7540.                                     size: "100%",
  7541.                                     borderWidth: 0,
  7542.                                     dataLabels: {
  7543.                                         enabled: false
  7544.                                     },
  7545.                                     point: {
  7546.                                         events: {
  7547.                                             click: function(e) {
  7548.                                                 e.preventDefault();
  7549.                                                 gaClickOnChart(this.index ? 'nonbranded' : 'branded');
  7550.                                                 _this._goToReport(this.index ? 0 : 1);
  7551.                                             },
  7552.                                             legendItemClick: function(e) {
  7553.                                                 e.preventDefault();
  7554.                                                 gaClickOnChart(this.index ? 'nonbranded' : 'branded');
  7555.                                                 _this._goToReport(this.index ? 0 : 1);
  7556.                                             }
  7557.                                         }
  7558.                                     }
  7559.                                 }
  7560.                             },
  7561.                             tooltip: {
  7562.                                 formatter: function() {
  7563.                                     return this.key + ": " + this.percentage.toFixed(2) + "%";
  7564.                                 }
  7565.                             },
  7566.                             colors: ["#8bc835", "#0074ba"]
  7567.                         },
  7568.                         templates: {
  7569.                             header: HEADER_TEMPLATE,
  7570.                             nothingFound: NOTHING_FOUND_TEMPLATE
  7571.                         },
  7572.                         getData: function(backendReports) {
  7573.                             var ret = _.values(backendReports.toJSON())
  7574.                               , model = (typeof ret[0] != 'undefined' && typeof ret[0].models != 'undefined' && ret[0].models.length && typeof ret[0].models[0] != 'undefined') ? ret[0].models : [];
  7575.                             var data = [];
  7576.                             if (model.length > 0) {
  7577.                                 var result = model[0]
  7578.                                   , sum = result.get('Ot')
  7579.                                   , traffic = {
  7580.                                     branded: result.get('Td'),
  7581.                                     not_branded: (result.get('Ot') - result.get('Td'))
  7582.                                 };
  7583.                                 if (sum > 0) {
  7584.                                     data = _.map(traffic, function(item, type) {
  7585.                                         if (typeof item !== "undefined" && !isNaN(item)) {
  7586.                                             return [CONF.LOCALE['chart_value_' + type], item * 100 / sum];
  7587.                                         } else {
  7588.                                             return;
  7589.                                         }
  7590.                                     }, this);
  7591.                                 }
  7592.                             }
  7593.                             if (data.length > 0) {
  7594.                                 data = [{
  7595.                                     data: data,
  7596.                                     type: "pie"
  7597.                                 }];
  7598.                             } else {
  7599.                                 if (typeof ret[0].models != 'undefined' && ret[0].models.length) {
  7600.                                     this.el.html(_.template(NOTHING_FOUND_TEMPLATE)({
  7601.                                         LOCALE: CONF.LOCALE
  7602.                                     }));
  7603.                                 }
  7604.                             }
  7605.                             return data;
  7606.                         },
  7607.                         labelClass: CONF.MIDDLE_WARE.labelClass,
  7608.                         labelText: CONF.MIDDLE_WARE.labelText
  7609.                     };
  7610.                     if (reportConfig) {
  7611.                         app.deepExtend(this.reportConfig, reportConfig);
  7612.                     }
  7613.                     return this.render();
  7614.                 },
  7615.                 _goToReport: function(type) {
  7616.                     window.location = app.conf.DB_PREFIX + app.conf.DB_DATE_PREFIX + '/info/' + this.CONF.MIDDLE_WARE.domain_id + '+(by+organic)?filter=' + encodeURIComponent('+|Br|Eq|') + type;
  7617.                 },
  7618.                 render: function() {
  7619.                     return new app.ReportChart(this.reportConfig);
  7620.                 }
  7621.             });
  7622.         }
  7623.         .apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  7624.         __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  7625.     }
  7626.     , function(module, exports, __webpack_require__) {
  7627.         var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  7628.         !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(39), __webpack_require__(78), __webpack_require__(125), __webpack_require__(4), __webpack_require__(5)],
  7629.         __WEBPACK_AMD_DEFINE_RESULT__ = function(_, HEADER_TEMPLATE, NOTHING_FOUND_TEMPLATE, CONTENT_TEMPLATE, Backbone) {
  7630.             "use strict";
  7631.             var getGaWidgetName = function() {
  7632.                 return 'Branded search'
  7633.             }
  7634.             var gaClickOnNumber = function() {
  7635.                 sendGa('click to number of kewords');
  7636.             }
  7637.             var sendGa = function(label) {
  7638.                 var action = getGaWidgetName();
  7639.                 if (typeof ga !== 'undefined') {
  7640.                     ga('send', 'event', 'Domain overview', action, label);
  7641.                 }
  7642.             }
  7643.             return Backbone.View.extend({
  7644.                 initialize: function(options, reportConfig) {
  7645.                     var CONF = this.CONF = options;
  7646.                     this.reportConfig = {
  7647.                         el: $(CONF.EL),
  7648.                         title: CONF.LOCALE.title,
  7649.                         tooltip: CONF.LOCALE.title_tooltip,
  7650.                         tooltip_position: 'right',
  7651.                         MIDDLE_WARE: CONF.MIDDLE_WARE,
  7652.                         LOCALE: CONF.LOCALE,
  7653.                         gaLabel: getGaWidgetName() + ' - Overview',
  7654.                         reports: [{
  7655.                             back: (function() {
  7656.                                 var foo = {
  7657.                                     key: app.conf.KEY,
  7658.                                     domain: CONF.MIDDLE_WARE.domain_id,
  7659.                                     url: CONF.MIDDLE_WARE.backend_url,
  7660.                                     action: "report",
  7661.                                     type: "domain_rank",
  7662.                                     responceAction: "rank"
  7663.                                 };
  7664.                                 if (CONF.MIDDLE_WARE.exportHash) {
  7665.                                     foo.display_hash = CONF.MIDDLE_WARE.exportHash;
  7666.                                 }
  7667.                                 if (CONF.MIDDLE_WARE.current_db_date != 'current') {
  7668.                                     foo.display_date = CONF.MIDDLE_WARE.current_db_date + '15';
  7669.                                 }
  7670.                                 return foo;
  7671.                             }
  7672.                             )()
  7673.                         }, {
  7674.                             back: {
  7675.                                 key: app.conf.KEY,
  7676.                                 url: CONF.MIDDLE_WARE.backend_url,
  7677.                                 domain: CONF.MIDDLE_WARE.domain_id,
  7678.                                 display_hash: CONF.MIDDLE_WARE.exportHashH,
  7679.                                 action: "report",
  7680.                                 type: "domain_rank_history",
  7681.                                 display_sort: 'dt_desc',
  7682.                                 responceAction: "rank_history"
  7683.                             }
  7684.                         }],
  7685.                         templates: {
  7686.                             header: HEADER_TEMPLATE,
  7687.                             content: CONTENT_TEMPLATE
  7688.                         },
  7689.                         table: {
  7690.                             header: [],
  7691.                             footer: ''
  7692.                         }
  7693.                     };
  7694.                     if (reportConfig) {
  7695.                         app.deepExtend(this.reportConfig, reportConfig);
  7696.                     }
  7697.                     this.render();
  7698.                 },
  7699.                 render: function() {
  7700.                     var CONF = this.CONF;
  7701.                     this.report = new (app.ReportWidget.extend({
  7702.                         events: {
  7703.                             'click .sem-report-counter a': gaClickOnNumber,
  7704.                         },
  7705.                         getData: function(backendReports) {
  7706.                             this.CONF = CONF;
  7707.                             var backendModel, backendModelH, currentModel, models, lastMonth, col = new Backbone.Collection(), result = {
  7708.                                 traffic: 0,
  7709.                                 keyword_branded: 0,
  7710.                                 branded_prev: 0,
  7711.                                 branded_diff: 0
  7712.                             };
  7713.                             _.each(backendReports.toJSON(), function(model) {
  7714.                                 if (typeof model.responce.attributes !== "undefined") {
  7715.                                     if (model.type === "domain_rank") {
  7716.                                         backendModel = model;
  7717.                                     } else if (model.type === "domain_rank_history" && typeof model.display_daily == "undefined") {
  7718.                                         backendModelH = model;
  7719.                                     }
  7720.                                 }
  7721.                             });
  7722.                             if (typeof backendModelH !== "undefined" && backendModelH.length) {
  7723.                                 models = _.values(backendModelH.first())[0].models;
  7724.                                 if (CONF.MIDDLE_WARE.current_db_date == "current") {
  7725.                                     lastMonth = models[models.length - 1];
  7726.                                 } else {
  7727.                                     _.each(models, function(model) {
  7728.                                         if (model.get("Dt") < CONF.MIDDLE_WARE.current_db_date) {
  7729.                                             lastMonth = model;
  7730.                                         }
  7731.                                     });
  7732.                                 }
  7733.                                 if (lastMonth && lastMonth.get("Td")) {
  7734.                                     result.branded_prev = lastMonth.get("Td");
  7735.                                 }
  7736.                             }
  7737.                             if (typeof backendModel !== "undefined" && backendModel.length) {
  7738.                                 currentModel = undefined;
  7739.                                 _.each(backendModel.models, function(model) {
  7740.                                     currentModel = model;
  7741.                                     result.traffic = currentModel.get("Td") ? parseInt(currentModel.get("Td")) : 0;
  7742.                                     result.keyword_branded = currentModel.get("Cd") ? parseInt(currentModel.get("Cd")) : 0;
  7743.                                 })
  7744.                             }
  7745.                             var calcDiff = function(current, previous) {
  7746.                                 current = current || 0;
  7747.                                 previous = previous || 0;
  7748.                                 var diff = current - previous;
  7749.                                 if (previous > 0) {
  7750.                                     diff = Math.round(100 * diff / previous);
  7751.                                 } else if (current > 0) {
  7752.                                     diff = 100;
  7753.                                 }
  7754.                                 return diff;
  7755.                             }
  7756.                             if (lastMonth && lastMonth.get("Td")) {
  7757.                                 result.branded_diff = calcDiff(result.traffic, result.branded_prev);
  7758.                             }
  7759.                             col.push(result);
  7760.                             if (typeof backendModel !== "undefined") {
  7761.                                 if (!result.traffic || !result.keyword_branded) {
  7762.                                     $('#brandedTraffic').remove();
  7763.                                 } else {
  7764.                                     this._showNotification('branded-traffic-overview');
  7765.                                 }
  7766.                             }
  7767.                             return col;
  7768.                         },
  7769.                         _showNotification: function(type) {
  7770.                             $('.' + type + '-notification').show();
  7771.                         },
  7772.                         _hideNotification: function(type) {
  7773.                             $('.' + type + '-notification').hide();
  7774.                         }
  7775.                     }))(this.reportConfig);
  7776.                 }
  7777.             });
  7778.         }
  7779.         .apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  7780.         __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  7781.     }
  7782.     , function(module, exports) {
  7783.         module.exports = "<% if (typeof data !== \"undefined\" && data.length) {\n\t\tvar model = data.first(), sign, cssClass;\n%>\n\t<%\tsign = model.get(\"branded_diff\") > 0 ? \"+\" : \"\";\n\t\tcssClass = model.get(\"branded_diff\") > 0 ? 'positive' : (model.get(\"branded_diff\") == 0 ? \"\" : 'negative'); %>\n\t<div class=\"sem-report-block-row\">\n\t\t<div class=\"sem-report-block-row-td minimized\">\n\t\t\t<%= helper.roundNumRankFormatted(model.get(\"traffic\")) %>\n\t\t</div>\n\t\t<div class=\"sem-report-block-row-td minimized\">\n\t\t\t<div class=\"sem-report-header-td-diff <%= cssClass %>\"><%= sign + model.get(\"branded_diff\") %>%</div>\n\t\t</div>\n\t\t<div class=\"sem-report-block-row-td sem-report-counter-title\"><%= LOCALE.traffic %></div>\n\t</div>\n\t<div class=\"report-delimiter\"></div>\n\t<table class=\"sem-report-block-summary-table\">\n\t\t<tr>\n\t\t\t<td><%= LOCALE.branded %></td>\n\t\t\t<td class=\"right\">\n\t\t\t\t<span class=\"sem-report-counter\">\n\t\t\t\t\t<a href=\"<%= app.conf.DB_PREFIX + app.conf.DB_DATE_PREFIX + '/info/' + MIDDLE_WARE.domain_id + '+(by+organic)?filter=' + encodeURIComponent('+|Br|Eq|1') %>\">\n\t\t\t\t\t\t<%= helper.roundNumRank(model.get(\"keyword_branded\")) %>\n\t\t\t\t\t</a>\n\t\t\t\t</span>\n\t\t\t</td>\n\t\t</tr>\n\t</table>\n<% } %>\n"
  7784.     }
  7785.     , function(module, exports, __webpack_require__) {
  7786.         var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  7787.         !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(4), __webpack_require__(5)],
  7788.         __WEBPACK_AMD_DEFINE_RESULT__ = function(_, Backbone) {
  7789.             "use strict";
  7790.             var getGaWidgetName = function() {
  7791.                 return 'Branded traffic trend'
  7792.             }
  7793.             var gaClickOnColumn = function(column) {
  7794.                 sendGa('click - ' + column);
  7795.             }
  7796.             var sendGa = function(label) {
  7797.                 var action = getGaWidgetName();
  7798.                 if (typeof ga !== 'undefined') {
  7799.                     ga('send', 'event', 'Domain overview', action, label);
  7800.                 }
  7801.             }
  7802.             return Backbone.View.extend({
  7803.                 initialize: function(options, reportConfig) {
  7804.                     var CONF = this.CONF = options;
  7805.                     this.reportConfig = {
  7806.                         el: $(CONF.EL),
  7807.                         title: CONF.LOCALE.title,
  7808.                         tooltip: CONF.LOCALE.title_tooltip,
  7809.                         MIDDLE_WARE: CONF.MIDDLE_WARE,
  7810.                         LOCALE: CONF.LOCALE,
  7811.                         gaLabel: getGaWidgetName() + ' - Overview',
  7812.                         reports: function() {
  7813.                             var backs = [{
  7814.                                 back: {
  7815.                                     key: app.conf.KEY,
  7816.                                     url: CONF.MIDDLE_WARE.backend_url,
  7817.                                     domain: CONF.MIDDLE_WARE.domain_id,
  7818.                                     display_hash: CONF.MIDDLE_WARE.exportHash,
  7819.                                     action: "report",
  7820.                                     type: CONF.MIDDLE_WARE.is_new_api ? "branded_traffic_trend" : "domain_rank",
  7821.                                     responceAction: CONF.MIDDLE_WARE.is_new_api ? "branded_traffic_trend" : "rank"
  7822.                                 }
  7823.                             }];
  7824.                             if (CONF.MIDDLE_WARE.is_new_api) {
  7825.                                 backs[0].back.database = CONF.MIDDLE_WARE.current_db;
  7826.                                 backs[0].back.export = 'json';
  7827.                             }
  7828.                             return backs;
  7829.                         },
  7830.                         chartOptions: {
  7831.                             chart: {
  7832.                                 type: "column",
  7833.                                 height: 110,
  7834.                                 spacingTop: 5,
  7835.                                 spacingLeft: 10,
  7836.                                 spacingRight: 10,
  7837.                                 spacingBottom: 5,
  7838.                                 backgroundColor: CONF.MIDDLE_WARE.show_watermark ? null : '#fff'
  7839.                             },
  7840.                             colors: ['#64b0e2'],
  7841.                             title: {
  7842.                                 text: null
  7843.                             },
  7844.                             plotOptions: {
  7845.                                 series: {
  7846.                                     shadow: false
  7847.                                 },
  7848.                                 column: {
  7849.                                     events: {
  7850.                                         'click': function(e) {
  7851.                                             gaClickOnColumn(e.target.point.index);
  7852.                                         }
  7853.                                     }
  7854.                                 }
  7855.                             },
  7856.                             xAxis: {
  7857.                                 gridLineWidth: 0,
  7858.                                 tickWidth: 0,
  7859.                                 lineWidth: 0,
  7860.                                 labels: {
  7861.                                     enabled: false
  7862.                                 }
  7863.                             },
  7864.                             yAxis: {
  7865.                                 showFirstLabel: false,
  7866.                                 gridLineColor: "#dae4e7",
  7867.                                 gridLineDashStyle: 'shortdash',
  7868.                                 min: 0,
  7869.                                 max: 1,
  7870.                                 tickInterval: 0.5,
  7871.                                 title: {
  7872.                                     text: null
  7873.                                 },
  7874.                                 labels: {
  7875.                                     style: {
  7876.                                         fontSize: 10,
  7877.                                         color: '#999999'
  7878.                                     }
  7879.                                 }
  7880.                             },
  7881.                             tooltip: {
  7882.                                 snap: 2,
  7883.                                 formatter: function() {
  7884.                                     return this.series.name + ": " + app.numberFormat(this.y, 2, ".", ",");
  7885.                                 }
  7886.                             },
  7887.                             legend: {
  7888.                                 enabled: false
  7889.                             }
  7890.                         },
  7891.                         templates: {
  7892.                             header: function() {
  7893.                                 return "<h3 class=\"sem-widget-header-title\">" + "<%= options.title %>" + "<%= (options.tooltip) ? ' <div class=\"sem-report-title-info sem-report-with-tooltip\"><div class=\"sem-report-title-info-description sem-report-tooltip-down\">' + options.tooltip + '</div></div>' : '' %>" + "</h3>";
  7894.                             }
  7895.                         },
  7896.                         getData: function(backendReports) {
  7897.                             if (CONF.MIDDLE_WARE.is_new_api) {
  7898.                                 var data = _.compact(_.map(backendReports.toJSON(), function(item) {
  7899.                                     return item.map(function(val) {
  7900.                                         if (val.get("Bt"))
  7901.                                             return parseFloat((val.get("Bt") / 100).toFixed(2));
  7902.                                     });
  7903.                                 }, this));
  7904.                                 if (_.first(data).length > 0) {
  7905.                                     return [{
  7906.                                         name: CONF.MIDDLE_WARE.domain_id,
  7907.                                         data: _.first(data)
  7908.                                     }];
  7909.                                 } else {
  7910.                                     return [];
  7911.                                 }
  7912.                             }
  7913.                             var trendData;
  7914.                             var data = _.compact(_.map(backendReports.toJSON(), function(item) {
  7915.                                 return item.map(function(val) {
  7916.                                     if (val.get("Bt"))
  7917.                                         return val.get("Bt").split(",");
  7918.                                 });
  7919.                             }, this));
  7920.                             if (data.length > 0) {
  7921.                                 _.each(data, function(item) {
  7922.                                     _.each(item, function(dot) {
  7923.                                         trendData = _.map(dot, parseFloat);
  7924.                                     });
  7925.                                 });
  7926.                                 return [{
  7927.                                     name: CONF.MIDDLE_WARE.domain_id,
  7928.                                     data: trendData
  7929.                                 }];
  7930.                             } else {
  7931.                                 return [];
  7932.                             }
  7933.                         },
  7934.                         labelClass: CONF.MIDDLE_WARE.labelClass,
  7935.                         labelText: CONF.MIDDLE_WARE.labelText
  7936.                     };
  7937.                     if (reportConfig) {
  7938.                         app.deepExtend(this.reportConfig, reportConfig);
  7939.                     }
  7940.                     return this.render();
  7941.                 },
  7942.                 render: function() {
  7943.                     this.report = new app.ReportChart(this.reportConfig);
  7944.                 }
  7945.             });
  7946.         }
  7947.         .apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  7948.         __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  7949.     }
  7950.     ])
  7951. });
  7952. ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement