1jQuery(document).ready(function ($) { 2 'use strict'; 3 4 // if body has .et-fb than return the below code execution 5 // for divi builder wireframe mode interrupt the code execution 6 if (document.body.classList.contains('et-fb')) { 7 return; 8 } 9 10 $(".et_pb_scroll_top.et-pb-icon").each(function () { 11 // Remove the existing content 12 $(this).empty(); 13 14 const settings = dnxteFrontendBackToTopData.settingsFields; 15 16 const iconType = settings.button_icon_type, 17 buttonContent = settings.button_content, 18 iconText = settings.icon_text, 19 buttonText = settings.display_text, 20 iconPlacement = settings.icon_placement, 21 buttonPosition = settings.position, 22 hideOnMobile = settings.hide_on_mobile, 23 hideOnMobileSize = settings.hide_on_mobile_size, 24 buttonPaddingTop = settings.button_padding_top, 25 buttonPaddingRight = settings.button_padding_right, 26 buttonPaddingBottom = settings.button_padding_bottom, 27 buttonPaddingLeft = settings.button_padding_left, 28 buttonFontSize = settings.button_font_size, 29 buttonIconSize = settings.icon_size, 30 buttonFontWeight = settings.button_font_weight, 31 buttonFont = settings.button_font, 32 buttonIconColor = settings.icon_text_color, 33 buttonIconHoverColor = settings.icon_text_hover_color, 34 buttonBgColor = settings.bg_color, 35 buttonBgHoverColor = settings.bg_hover_color, 36 buttonBorderRadius = settings.border_radius, 37 positionOffsetRight = settings.position_offset_right, 38 positionOffsetLeft = settings.position_offset_left, 39 positionOffsetBottom = settings.position_offset_bottom, 40 buttonLineHeight = settings.button_line_height, 41 buttonLetterSpacing = settings.button_letter_spacing, 42 buttonTextAlign = settings.display_text_align, 43 iconPosition = settings.position, 44 borderWidth = settings.border_width, 45 borderStyle = settings.border_style, 46 borderColor = settings.border_color, 47 borderHoverColor = settings.border_hover_color; 48 49 $(this).addClass( 50 "dnxte-back-to-top-wrapper dnxte-back-to-top-" + buttonPosition, 51 ); 52 53 if ("1" == hideOnMobile && hideOnMobileSize) { 54 $(this).attr("data-hide-on-mobile-size", hideOnMobileSize); 55 $(this).addClass("dnxte-back-to-top-hide-on-mobile"); 56 } 57 58 const $el = $(".dnxte-back-to-top-hide-on-mobile"); 59 $el.each(function () { 60 const hideBelow = parseInt($(this).attr("data-hide-on-mobile-size"), 10); 61 62 if (window.innerWidth <= hideBelow) { 63 $(this).addClass("dnxte-back-to-top-hide-on-mobile"); 64 } else { 65 $(this).removeClass("dnxte-back-to-top-hide-on-mobile"); 66 } 67 }); 68 69 function toggleBackToTopVisibility() { 70 $("[data-hide-on-mobile-size]").each(function () { 71 const $el = $(this); 72 const maxWidth = parseInt($el.data("hide-on-mobile-size"), 10); 73 74 if (window.innerWidth <= maxWidth) { 75 $el.hide(); 76 } else { 77 $el.show(); 78 } 79 }); 80 } 81 82 // Run on load and on resize 83 toggleBackToTopVisibility(); 84 $(window).on("resize", toggleBackToTopVisibility); 85 86 $(this).css({ bottom: positionOffsetBottom + "px" }); 87 88 if ("left" === iconPosition) { 89 $(this).css({ 90 left: positionOffsetLeft + "px", 91 right: "unset", 92 }); 93 } else { 94 $(this).css({ 95 left: "unset", 96 right: positionOffsetRight + "px", 97 }); 98 } 99 100 $(window).on("resize", function () { 101 $el.each(function () { 102 const hideBelow = parseInt( 103 $(this).attr("data-hide-on-mobile-size"), 104 10, 105 ); 106 107 if (window.innerWidth <= hideBelow) { 108 $(this).addClass("dnxte-back-to-top-hide-on-mobile"); 109 } else { 110 $(this).removeClass("dnxte-back-to-top-hide-on-mobile"); 111 } 112 }); 113 }); 114 115 let icon = ""; 116 let displayText = dnxteFrontendBackToTopData.settingsFields.display_text; 117 118 if ("both" === buttonContent) { 119 if (iconType === "dashicon" && "left" == iconPlacement) { 120 icon = `<i class="dashicons ${dnxteFrontendBackToTopData.settingsFields.button_dashicon}"></i><span>${iconText}</span>`;
121 } else if ( 122 iconType === "custom_image" && 123 dnxteFrontendBackToTopData.settingsFields.button_custom_image && 124 "left" == iconPlacement 125 ) { 126 icon = `<img src="${dnxteFrontendBackToTopData.settingsFields.button_custom_image}" alt="Custom Icon" /><span>${iconText}</span>`; 127 } else if ( 128 iconType === "external_url" && 129 dnxteFrontendBackToTopData.settingsFields.button_external_url && 130 "left" == iconPlacement 131 ) { 132 icon = `<img src="${dnxteFrontendBackToTopData.settingsFields.button_external_url}" alt="Custom Icon" /><span>${iconText}</span>`; 133 } 134 135 if (iconType === "dashicon" && "right" == iconPlacement) { 136 icon = `<span>${iconText}</span><i class="dashicons ${dnxteFrontendBackToTopData.settingsFields.button_dashicon}"></i>`; 137 } else if ( 138 iconType === "custom_image" && 139 dnxteFrontendBackToTopData.settingsFields.button_custom_image && 140 "right" == iconPlacement 141 ) { 142 icon = `<span>${iconText}</span><img src="${dnxteFrontendBackToTopData.settingsFields.button_custom_image}" alt="Custom Icon" />`; 143 } else if ( 144 iconType === "external_url" && 145 dnxteFrontendBackToTopData.settingsFields.button_external_url && 146 "right" == iconPlacement 147 ) { 148 icon = `<span>${iconText}</span><img src="${dnxteFrontendBackToTopData.settingsFields.button_external_url}" alt="Custom Icon" />`; 149 } 150 } 151 152 if ("icon" == buttonContent && "dashicon" == iconType) { 153 icon = `<i class="dashicons ${dnxteFrontendBackToTopData.settingsFields.button_dashicon}"></i>`; 154 } else if ( 155 "icon" == buttonContent && 156 "custom_image" == iconType && 157 dnxteFrontendBackToTopData.settingsFields.button_custom_image 158 ) { 159 icon = `<img src="${dnxteFrontendBackToTopData.settingsFields.button_custom_image}" alt="Custom Icon" />`; 160 } else if ( 161 "icon" == buttonContent && 162 "external_url" == iconType && 163 dnxteFrontendBackToTopData.settingsFields.button_external_url 164 ) { 165 icon = `<img src="${dnxteFrontendBackToTopData.settingsFields.button_external_url}" alt="Custom Icon" />`; 166 } 167 168 if ("text" == buttonContent) { 169 icon = `<span>${iconText}</span>`; 170 } 171 172 if ("vertical" == buttonTextAlign) { 173 // Add the new button HTML 174 $(this).html( 175 '<button id="dnxte-back-to-top-button" class="dnxte-back-to-top dnxte-back-to-top-right"><span class="dnxte-back-to-top-vertical">' + 176 icon + 177 "</span></button>", 178 ); 179 } else { 180 // Add the new button HTML 181 $(this).html( 182 '<button id="dnxte-back-to-top-button" class="dnxte-back-to-top dnxte-back-to-top-right">' + 183 icon + 184 "</button>", 185 ); 186 } 187 188 const $btn = $(this).find(".dnxte-back-to-top"), 189 $btnImg = $(this).find(".dnxte-back-to-top img"), 190 $btnIcon = $(this).find(".dnxte-back-to-top i"); 191 192 if ($btnIcon.length) { 193 $btnIcon.css({ 194 "font-size": buttonIconSize + "px", 195 width: buttonIconSize + "px", 196 height: buttonIconSize + "px", 197 }); 198 } 199 200 if ($btnImg.length) { 201 $btnImg.css({ 202 "max-width": buttonIconSize + "px", 203 height: buttonIconSize + "px", 204 }); 205 } 206 207 $btn.on("mouseenter", function () { 208 $(this).css("background-color", buttonBgHoverColor); 209 $(this).css("color", buttonIconHoverColor); 210 $(this).css("border-color", borderHoverColor); 211 }); 212 213 $btn.on("mouseleave", function () { 214 $(this).css("background-color", buttonBgColor); 215 $(this).css("color", buttonIconColor); 216 $(this).css("border-color", borderColor); 217 }); 218 219 if ($btn.length) { 220 $btn.css({ 221 "padding-top": buttonPaddingTop + "px", 222 "padding-right": buttonPaddingRight + "px", 223 "padding-bottom": buttonPaddingBottom + "px", 224 "padding-left": buttonPaddingLeft + "px", 225 "border-radius": buttonBorderRadius + "px", 226 "border-width": borderWidth + "px", 227 "border-style": borderStyle, 228 "border-color": borderColor, 229 "background-color": buttonBgColor, 230 color: buttonIconColor, 231 "font-size": buttonFontSize + "px", 232 "font-family": `"${buttonFont}", sans-serif`, 233 "font-weight": buttonFontWeight, 234 "line-height": buttonLineHeight, 235 "letter-spacing": buttonLetterSpacing + "px", 236 }); 237 } 238 }); 239}); 240 241/** 242 * Apply visibility for back to top button 243 */ 244function applyBackToTopVisibility() { 245 jQuery(".et_pb_scroll_top.dnxte-back-to-top-wrapper").each(function () { 246 let i = jQuery(this), 247 o = parseInt(i.data("hide-on-mobile-size"), 10) || 767; 248 window.innerWidth <= o 249 ? i.css("display", "none").addClass("dnxte-back-to-top-hide-on-mobile") 250 : i.css("display", "inline").removeClass("dnxte-back-to-top-hide-on-mobile"); 251 }); 252} 253applyBackToTopVisibility(), jQuery(window).on("resize", applyBackToTopVisibility);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.