forked from a64f7bb4-7358-4778-9fbe-3b882c34cc1d/v1
2 lines
2.7 KiB
JavaScript
2 lines
2.7 KiB
JavaScript
!function(i,s,e,n){"use strict";var t=n,o="description",a="form-checkbox",r="b-"+o,l="b-"+a,f="b-form",c="form--vanilla-on",m="."+o+", .form-item__"+o,d="."+a,u=".form--slick",h=".form-item",v=".js-expandable",p=".b-hint",g="is-focused",C="is-hovered",b="is-selected",y="addClass",x="removeClass",_="checked",w="change",$="click";function S(e){var o=i(e);function s(e){e.removeClass(function(e,n){return(n.match(/(^|\s)form--media-switch-\S+/g)||[]).join(" ")})}i(".details-legend-prefix",o).removeClass("element-invisible"),o[i("."+a+"--vanilla",o).prop(_)?y:x](c),o.on($,"."+a,function(){var e=i(this),n=e.prop(_);e[n?y:x]("on"),e.hasClass(a+"--vanilla")&&(o[n?y:x](c),o[n?x:y]("form--vanilla-off"),n&&(s(o),i('select[name$="[media_switch]"]',o).val("")))}),i('select[name$="[style]"]',o).off(w).on(w,function(){var e=i(this).val();o.removeClass(function(e,n){return(n.match(/(^|\s)form--style-\S+/g)||[]).join(" ")}),""===e?o.addClass("form--style-off form--style-is-grid"):(o.addClass("form--style-on form--style-"+e),"column"!==e&&"grid"!==e&&"flex"!==e&&"nativegrid"!==e||o.addClass("form--style-is-grid"))}).change(),i('input[name$="[grid]"]',o).off(w).on(w,function(){var e=i(this).val();o[""===e?x:y]("form--grid-on")}).change(),o.on($,'input[name$="[override]"]',function(){var e=i(this).prop(_);o[e?y:x]("form--override-on")}),i('select[name$="[responsive_image_style]"]',o).off(w).on(w,function(){var e=i(this);o[""===e.val()?x:y]("form--responsive-image-on")}).change(),i('select[name$="[media_switch]"]',o).off(w).on(w,function(){var e=i(this).val();s(o),o[""===e?x:y]("form--media-switch-on"),o[""===e?x:y]("form--media-switch-"+e),o[""===e||"content"===e||"media"===e||"rendered"===e?x:y]("form--media-switch-lightbox")}).change(),o.on("mouseenter touchstart",p,function(){i(this).closest(h).addClass(C)}),o.on("mouseleave touchend",p,function(){i(this).closest(h).removeClass(C)}),o.on($,p,function(){i(".form-item."+b,o).removeClass(b),i(this).parent().toggleClass(b)}),o.on($,".description, .form-item__description",function(){i(this).closest("."+b).removeClass(b)}),o.off("focus").on("focus",v,function(){i(this).parent().addClass(g)}),o.off("blur").on("blur",v,function(){i(this).parent().removeClass(g)})}function j(e){e=i(e);e.hasClass(o)||e.addClass(o),e.siblings(p).length||e.closest(h).append('<span class="b-hint">?</span>')}function k(e){e=i(e);e.next(".field-suffix").length||e.after('<span class="field-suffix"></span>')}e.behaviors.blazyAdmin={attach:function(e){t=s.context(e),s.once(j,r,m,t),s.once(k,l,d,t),s.once(S,f,u,t)},detach:function(e,n,o){"unload"===o&&(s.once.removeSafely(r,m,t),s.once.removeSafely(l,d,t),s.once.removeSafely(f,u,t))}}}(jQuery,dBlazy,Drupal,this.document);
|