2026-02-05 17:08:59 +03:00

1 line
2.0 KiB
JavaScript

!function(t){"use strict";var e=function(e){var i,a;(a={}).readOnly=void 0!==t(e).data("readonly")&&t(e).data("readonly"),a.lineNumbers=void 0!==t(e).data("linenumbers")&&t(e).data("linenumbers"),a.lineWrapping=void 0!==t(e).data("linewrapping")&&t(e).data("linewrapping"),a.theme=void 0!==t(e).data("theme")?t(e).data("theme"):"default",a.mode=void 0!==t(e).data("mode")?t(e).data("mode"):"text/html",i=wp.CodeMirror.fromTextArea(e,a),t(e).addClass("code-mirror-initialized"),i.setSize("100%","auto"),t(document).trigger("resize"),t(e).parents(".fusion-syntax-highlighter-container").css("opacity","1")};t(document).on("ready",(function(){var i,a,n,r=t(".fusion-syntax-highlighter-textarea");t.each(r,(function(i,r){a=t(r).parents(".fusion-tabs"),n=t(r).parents(".fusion-panel"),t(r).parents(".fusion-builder-element-content").length||(a.length?0===a.find(".nav-tabs li.active").index()&&a.find(".nav-tabs li.active .tab-link").attr("href")==="#"+t(r).parents(".tab-pane").attr("id")?e(r):a.find(".tab-link").on("click",(function(){t(this).attr("href")!=="#"+t(r).parents(".tab-pane").attr("id")||t(r).hasClass("code-mirror-initialized")||setTimeout((function(){e(r)}),200)})):n.length?(n.find(".panel-title a.active").length&&(r=n.find(n.find(".panel-title a.active").attr("href")).find(".fusion-syntax-highlighter-textarea")[0],e(r)),n.find(".panel-title a").on("click",(function(){t(this).attr("href")!=="#"+t(r).parents(".panel-collapse").attr("id")||t(r).hasClass("code-mirror-initialized")||setTimeout((function(){e(r)}),200)}))):e(r))})),t(".syntax-highlighter-copy-code-title").on("click",(function(){var e=t(this);i=document.getElementById(t(this).data("id")),e.parent(".syntax-highlighter-copy-code").addClass("syntax-highlighter-copying"),t(i).removeAttr("style").css({position:"absolute",left:"-1000%"}),t(i).select(),document.execCommand("Copy",!1,null),setTimeout((function(){e.parent(".syntax-highlighter-copy-code").removeClass("syntax-highlighter-copying")}),200)}))}))}(jQuery);