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AC,MAAd,GAAuB;AANX;AA3IT;AAAA;AAAA,aAmJL,sBAAY;AACV,YAAG,MAAM,CAAC,YAAP,EAAH;AACE,eAAC,SAAD,CAAW,IAAX,CAAgB,yBAAhB,EAA2C,MAA3C,CAAkD,KAAC,SAAD,CAAW,IAAX,CAAgB,yBAAhB,EAA2C,KAA3C,EAAlD;iBACA,KAAC,SAAD,CAAW,IAAX,CAAgB,mBAAhB,EAAqC,MAArC,CAA4C,KAAC,SAAD,CAAW,IAAX,CAAgB,mBAAhB,EAAqC,KAArC,EAA5C;AAFF;iBAIE,KAAC,SAAD,CAAW,IAAX,CAAgB,YAAhB,EAA8B,MAA9B,CAAqC,KAAC,SAAD,CAAW,IAAX,CAAgB,YAAhB,EAA8B,KAA9B,EAArC;;AALQ;AAnJP;;AAAA;AAAA;;AA0JP,QAAM,CAAC,aAAP,GAAuB,aAAvB;AACA,QAAM,CAAC,aAAP,GAAuB,IAAI,aAAJ,EAAvB;CA3JC","file":"CGGridManager.es5.js","sourcesContent":["class CGGridManager\n  constructor: () ->\n    @minimumElemWidth = 220\n    @duration = 1000\n\n  buildGrid: (container) ->\n    @container = container\n    #@nbCols = Math.floor(@container.width() / @minimumElemWidth)\n    @detailsVisible = false\n    \n    @nbCols = 5\n    if container.parents(\".popupdiv\").hasClass(\"branches\")\n      @nbCols = @container.find(\".grid-elem\").length\n\n    @elemWidth = 100 / @nbCols\n    @container.find(\".grid-elem\").each (index, elem) ->\n      elem = $(elem)\n      window.cgGridManager.initElem(elem)\n    $(\"div.popupdiv\").addClass(\"initialized\")\n    $(window).resize($.proxy(@resizeGrid,this))\n    if container.parents(\".popupdiv\").hasClass(\"trust\")      \n      $('body').overlayScrollbars\n        callbacks:\n          onScroll: () -> \n            window.cgNewsManager.appendNews(window.cgGridManager.container,false)\n      window.cgNewsManager.appendNews(@container,false)\n    @initTooltips($(\"div.popupdiv-content\"))\n    \n  initTooltips: (container) ->\n    container.find(\".tooltip-icon\").click (event) ->\n      target = $(event.currentTarget)\n      target.find(\".tooltip-content\").toggle()\n\n  initElem: (elem) ->\n    image = elem.find('.grid-elem-image-content')\n    image.css\n      'background-image' : \"url('#{image.attr 'data-image'}')\"\n    elem.css\n      \"width\" : \"#{@elemWidth}%\"\n    elem.height(@container.find(\".grid-elem:not(.active)\").width())\n\n    elem.find(\"a\").click($.proxy(@showDetails,this))\n          \n  showDetails: (event) ->\n    url = $(event.currentTarget).attr(\"href\")\n    if @detailsVisible && url.indexOf(\"ShowBranch\") < 0\n      elem = $(event.currentTarget)\n      animate = true\n      if elem.parents(\".grid-elem\").is(\".active\")\n        animate = false\n      @hideDetails()\n      if animate\n        $(document).on \"detailsRemoved\", () ->\n          window.cgGridManager.animateDetails(event)\n    else\n      @animateDetails(event)\n\n    false\n\n  animateDetails: (event) ->\n    $(document).unbind(\"detailsRemoved\")\n    @detailsVisible = true\n    elem = $(event.currentTarget)\n    url = elem.attr(\"href\")\n    $.ajax\n      cache: false\n      context: this\n      url : url\n      complete : (result) ->\n        bloc = document.createElement(\"div\")\n        bloc.setAttribute(\"class\",\"grid-details\")\n        $(bloc).html(result.responseText)\n        context = this\n        if url.indexOf(\"ShowBranch\") >= 0\n          if @container.find(\".grid-details\").length > 0\n            @container.find(\".grid-details\").replaceWith(bloc)\n          else\n            elem.parents(\".grid-elem\").after(bloc)\n          @container.find(\".branchdiv-filter\").css\n            \"width\" : \"#{@elemWidth}%\"\n        else\n          elem.parents(\".grid-elem\").after(bloc)\n\n        @initTooltips($(\".grid-details\"))\n        \n        $(bloc).find(\"#specificnews-img\").css\n          \"line-height\": @container.find(\".grid-elem\").width() * 2 + \"px\"\n        if url.indexOf(\"ShowBranch\") >= 0\n          height = \"auto\"\n          $(\"#branchdiv a.branchdiv-filter.active\").css\n            \"color\" : \"#999999\"\n            \"border-color\" : \"#999999\"\n          $(\"#branchdiv a.branchdiv-filter.active .lighter\").css\n            \"background-color\" : \"transparent\"\n          $(\"#branchdiv a.branchdiv-filter[href='#{url}']\").addClass(\"active\")\n          color = $(\"#branchdiv a.branchdiv-filter.active\").attr(\"data-active-color\")\n          $(\"#branchdiv a.branchdiv-filter.active\").css\n            \"color\" : color\n            \"border-color\" : color\n          $(\"#branchdiv a.branchdiv-filter.active .lighter\").css\n            \"background-color\" : color\n          if not elem.hasClass(\"branchdiv-filter\")\n            if window.isSmartphone()\n              $(\".grid-elem.active\").height(@container.find(\".grid-elem:not(.active)\").width())\n            $(\".grid-elem.active\").removeClass(\"active\")\n            elem.parents(\".grid-elem\").addClass(\"active\")\n            if window.isSmartphone()\n              $(\".grid-elem.active\").height(@container.find(\".grid-elem.active\").width())\n          $(\"#branchdiv a.branchdiv-filter\").click($.proxy(@showDetails,this))\n          $(\"#branchdiv a.claimslink\").click (event) ->\n            url = $(event.currentTarget).attr(\"href\")\n            window.cgClaimManager.showClaims(url)\n        else\n          $(\".grid-elem.active\").removeClass(\"active\")\n          elem.parents(\".grid-elem\").addClass(\"active\")\n\n          $(\"body,html\").animate\n            scrollTop : elem.offset()[\"top\"]\n          $(bloc).stop().animate {\n              \"height\" : @container.find(\".grid-elem\").width() * 2 + \"px\"\n            },\n            duration : @duration /2\n            complete: () ->\n              $(bloc).find(\"p.text\").overlayScrollbars({ })\n              $(bloc).find(\".close\").click($.proxy(context.hideDetails,context))\n    false\n\n  hideDetails: () ->\n    @detailsVisible = false\n    $(\".grid-elem.active\").removeClass(\"active\")\n    $(\".grid-details\").animate {\n        \"height\" : 0\n      },\n      duration: @duration /2\n      complete: () ->\n        $(\".grid-details\").remove()\n        $(document).trigger \"detailsRemoved\"\n    false\n\n  findNextLine: (elem) ->\n    if elem.hasClass(\"branchdiv-filter\")\n      line = 0\n    else \n      index = elem.parents(\".grid-elem\").index()\n      line = Math.floor(index / @nbCols)\n    (line + 1) * @nbCols - 1\n\n  resizeGrid: () ->\n    if window.isSmartphone()\n      @container.find(\".grid-elem:not(.active)\").height(@container.find(\".grid-elem:not(.active)\").width())\n      @container.find(\".grid-elem.active\").height(@container.find(\".grid-elem.active\").width())\n    else\n      @container.find(\".grid-elem\").height(@container.find(\".grid-elem\").width())\n\nwindow.CGGridManager = CGGridManager\nwindow.cgGridManager = new CGGridManager()"]}