Sha256: 181b57a8773d9f2077d15d87feb040865a8535fc53cbca4019007a41da147330
Contents?: true
Size: 1.78 KB
Versions: 21
Compression:
Stored size: 1.78 KB
Contents
$(() => { const $allDiffViews = $(".row.diff_view"); $(document).on("click", ".diff-view-by a.diff-view-mode", (event) => { event.preventDefault(); const $target = $(event.target) let type = "escaped"; const $selected = $target.parents(".is-dropdown-submenu-parent").find("#diff-view-selected"); if ($selected.text().trim() === $target.text().trim()) { return; } $selected.text($target.text()); if ($target.attr("id") === "diff-view-unified") { if ($(".row.diff_view_split_escaped").hasClass("hide")) { type = "unescaped"; } $allDiffViews.addClass("hide"); $(`.row.diff_view_unified_${type}`).removeClass("hide"); } if ($target.attr("id") === "diff-view-split") { if ($(".row.diff_view_unified_escaped").hasClass("hide")) { type = "unescaped"; } $allDiffViews.addClass("hide"); $(`.row.diff_view_split_${type}`).removeClass("hide"); } }) $(document).on("click", ".diff-view-by a.diff-view-html", (event) => { event.preventDefault(); const $target = $(event.target); $target.parents(".is-dropdown-submenu-parent").find("#diff-view-html-selected").text($target.text()); const $visibleDiffViewsId = $allDiffViews.not(".hide").first().attr("id").split("_").slice(1, -1).join("_"); const $visibleDiffViews = $allDiffViews.filter(`[id*=${$visibleDiffViewsId}]`) if ($target.attr("id") === "diff-view-escaped-html") { $visibleDiffViews.filter("[id$=_unescaped]").addClass("hide"); $visibleDiffViews.filter("[id$=_escaped]").removeClass("hide"); } if ($target.attr("id") === "diff-view-unescaped-html") { $visibleDiffViews.filter("[id$=_escaped]").addClass("hide"); $visibleDiffViews.filter("[id$=_unescaped]").removeClass("hide"); } }) });
Version data entries
21 entries across 21 versions & 1 rubygems