Файл: touchSpace/js/dd_menu.js
Строк: 206
<?php
define("dd_menu","init",function(){function e(){var e,t=n();return t?(e=jQuery.Event("dd_menu_close"),t.trigger(e),e.isDefaultPrevented()?!1:(t.prop("menuOpener",null),t.data("menu_opened",!1),$(".drop-down-list_inner").removeClass("drop-down-list_inner_open"),$(".js-dd_menu_link").removeClass("js-clicked clicked "+a),t.hide(),a="",$("body").off(".ddmenu"),$(window).off(".ddmenu"),t=null,!0)):!0}function n(){var e=$(".dropdown-menu__wrap:visible");return e.length?(e.data("menu_opened",!0),e):null}function t(e,n){var t,o;return n=extend({yes:"Да",no:"Нет",yes_ico:"delete",no_ico:"history"},n),t=n.id||"confirm_"+(new Date).getTime(),o=$('<div class="user__dropdown-menu dropdown-menu__wrap js-dd_menu_item" id="'+t+'"><div class="widgets-group dropdown-menu"><div class="content-bl text help-block t_center _confirm_content"></div><table class="table__wrap"><tr><td class="table__cell links-group links-group_attention table_cell_border" width="50%"><a href="#" class="list-link js-confirm_yes" data-id="'+t+'"><span class="ico ico_'+n.yes_ico+'"></span>'+n.yes+'</a></td><td class="table__cell links-group links-group_grey table__cell_last" width="50%"><a href="#" class="list-link js-confirm_cancel" data-id="'+t+'"><span class="ico ico_'+n.no_ico+'"></span>'+n.no+"</a></td></tr></table></div></div>"),o.find("._confirm_content").append(e),o}var o,a="";$("body").on("click",".js-dd_menu_link, .js-delete-confirm",function(t){var a,i,d,s,r,l,c,_,p,u,m,f,g,w,y,v,h,k;t.stopPropagation(),t.preventDefault(),a=$(this),i=a.hasClass("js-delete-confirm"),d=a.attr("id"),s=a.data("menu_id"),r=$("#"+s),l=a.data("inner"),c=a.data("custom_class"),_=a.data("allow_only")||!1,p=$(".js-dd_menu_link"),r.prop("menuOpener",a),u=n(),u&&(m=u.position()),f=u&&u.attr("id")==s,e()&&!f&&(g=jQuery.Event("dd_menu_open"),r.trigger(g),g.isDefaultPrevented()||(r.data("menu_opened",!0),u=r,o=i?o||a:a,c&&a.addClass(c),l&&$("#"+l).addClass("drop-down-list_inner_open"),o.addClass("js-clicked "+(a.data("noclass")?"":"clicked")),w=a.data("date_selector"),y=a.data("search_city"),v=a.data("search_country"),h=a.data("search_universal_type"),i?(a.data("noposition")||r.css({top:m.top+"px"}),r.show()):"new_status_btn"==d?($(window).on("resize.ddmenu",function(){r.css({"margin-top":"-"+a.position().top+"px"})}),$(window).trigger("resize.ddmenu"),$("#new_status_ta").select(),r.show()):w?dateSelectorInit({id:d,cal_id:s}):y?searchCityInit({id:s,elId:d,allow_only:_}):v?searchCityInit({id:s,elId:d,country_only:1}):h?searchUniversalInit({id:s,elId:d,type:h}):a.data("position")?(k=r.css({top:0}).show().offset().top,r.css({top:a.offset().top+a.height()-k+20+"px"})):r.show(),u.trigger($.Event("dd_menu_opened")),$("body").on("click.ddmenu",function(n){n&&n.target&&n.target.ajax_upload_button||e()})))}),$("body").on("click",".js-dd_menu_item",function(e){e.ajaxify||e.stopPropagation()}),$("body").on("click",".js-dd_menu_close, .js-cancel",function(n){n.stopPropagation(),n.preventDefault(),e()}),$("body").on("click",".js-confirm_yes",function(n){n.stopPropagation(),n.preventDefault(),$("#"+$(this).data("id")).trigger("confirm"),e()}),$("body").on("click",".js-confirm_cancel",function(n){n.stopPropagation(),n.preventDefault(),$("#"+$(this).data("id")).trigger("cancel"),e()}),Spaces.DdMenu={createConfirm:function(e,n,o){var a=t(n,o);return e.data("menu_id",a.attr("id")).data("position","1").addClass("js-dd_menu_link"),Spaces.view.pushWidget(a),a}}});
?>