| 1 |
var _dkf_iframe_disabled=window!==window.top&&"undefined"!=typeof darkify_is_this_admin_panel&&"1"!==darkify_is_this_admin_panel&&"undefined"!=typeof darkify_enable_frontend_iframe_dark_mode&&"1"!==darkify_enable_frontend_iframe_dark_mode;let has_process_run_at_least_once=!1,old_transition="",has_background_img_url=!1,darken_level=parseInt(darkify_bg_image_darken_to)/100,darkify_secondary_bg_color=(darken_level=darken_level.toFixed(1),""),darkify_observer=(darkify_init_keyboard_shortcut_listener(),darkify_init_os_mode_change_listener(),new MutationObserver(function(e){darkify_init_processes(),darkify_process_iframes()})),elements_class_changed=new MutationObserver(e=>{"loading"!==document.readyState&&e.forEach(e=>{e=e.target;if(e.classList.contains("darkify_processed")){if(e.hasAttribute("data-darkify_preserved_classes")){if(e.dataset.darkify_preserved_classes===e.classList.toString())return}else e.dataset.darkify_preserved_classes=e.classList.toString();e.dataset.darkify_preserved_classes=e.classList.toString(),elements_class_changed.disconnect(),e.classList.remove("darkify_processed"),darkify_process_element(e),document.querySelectorAll("*:not(head, title, link, meta, script, style, defs, filter)").forEach(e=>{elements_class_changed.observe(e,{attributes:!0,attributeFilter:["class"]})})}})}),dark_mode_status_changed=new MutationObserver(e=>{e.forEach(e=>{"attributes"===e.type&&"class"===e.attributeName&&document.querySelectorAll("*:not(head, title, link, meta, script, style, defs, filter)").forEach(e=>{var a;!e.classList.contains("darkify_processed")||0<darkify_disallowed_elements.length&&e.matches(darkify_disallowed_elements)||("1"===darkify_enable_bg_image_darken&&darkify_darken_bg_image(e,darken_level),"1"!==darkify_enable_low_image_brightness&&"1"!==darkify_enable_image_grayscale||"img"!==e.nodeName.toLowerCase()||darkify_img_brightness_and_grayscale(e),"1"===darkify_enable_invert_inline_svg&&"svg"===e.nodeName.toLowerCase()&&darkify_invert_inline_svg(e),"1"!==darkify_enable_low_video_brightness&&"1"!==darkify_enable_video_grayscale||("video"===e.nodeName.toLowerCase()&&darkify_video_brightness_and_grayscale(e),"iframe"===e.nodeName.toLowerCase()&&null!=e.getAttribute("src")&&((a=e.getAttribute("src")).includes("youtube")||a.includes("vimeo")||a.includes("dailymotion"))&&darkify_video_brightness_and_grayscale(e)),e.hasAttribute("data-darkify_alpha_bg")&&darkify_fix_background_color_alpha(e))})})});function darkify_change_state(){"1"===darkify_is_this_admin_panel?localStorage.darkify_admin_panel_last_state=document.getElementsByTagName("html")[0].classList.contains("darkify_dark_mode_enabled")?"1":"0":localStorage.darkify_last_state=document.getElementsByTagName("html")[0].classList.contains("darkify_dark_mode_enabled")?"1":"0"}function darkify_switch_trigger(){has_process_run_at_least_once||(darkify_init_processes(),darkify_init_observer());var e=document.getElementsByTagName("html")[0];e.classList.contains("darkify_dark_mode_enabled")?e.classList.remove("darkify_dark_mode_enabled"):e.classList.add("darkify_dark_mode_enabled"),darkify_change_state(),darkify_process_iframes()}function darkify_theme_select(e){if(darkify_is_block_editor_context()){has_process_run_at_least_once||(darkify_init_processes(),darkify_init_observer());let a=document.documentElement;a.classList.forEach(e=>{e.startsWith("darkify-")&&a.classList.remove(e)}),darkify_update_theme_selectors(localStorage.darkify_selected_theme=e),"1"===darkify_is_this_admin_panel&&("1"===localStorage.darkify_admin_panel_last_state?(a.classList.add("darkify_dark_mode_enabled"),a.classList.add("darkify-"+e)):a.classList.remove("darkify_dark_mode_enabled")),darkify_change_state(),darkify_apply_palette(e),darkify_process_iframes()}}function darkify_update_theme_selectors(a){document.querySelectorAll(".darkify-theme-selector").forEach(function(e){e.value!==a&&(e.value=a)})}function darkify_is_block_editor_context(){return"undefined"!=typeof document&&document.body&&(document.body.classList.contains("block-editor-page")||null!==document.querySelector(".edit-post-visual-editor")||null!==document.querySelector(".block-editor"))}function darkify_restore_selected_theme(){var e;darkify_is_block_editor_context()&&(e=localStorage.darkify_selected_theme)&&(darkify_update_theme_selectors(e),darkify_theme_select(e))}function darkify_apply_palette(e){var a;darkify_is_block_editor_context()&&(e=(a={set1:{bg:"#0F0F0F",secondary_bg:"#171717",text_color:"#BEBEBE",link_color:"#E7E7E7",link_hover_color:"#BEBEBE",input_bg:"#2D2D2D",input_text_color:"#BEBEBE",input_placeholder_color:"#BEBEBE",border_color:"#4A4A4A",btn_text_color:"#BEBEBE",btn_bg:"#4A4A4A",btn_text_hover_color:"#BEBEBE",btn_hover_bg:"#2D2D2D"},set3:{bg:"#211e3c",secondary_bg:"#302C57",text_color:"#B1BBD8",link_color:"#8071fb",link_hover_color:"#B1BBD8",input_bg:"#2A264D",input_text_color:"#B1BBD8",input_placeholder_color:"#B1BBD8",border_color:"#4E478D",btn_text_color:"#B1BBD8",btn_bg:"#4E478D",btn_text_hover_color:"#B1BBD8",btn_hover_bg:"#2A264D"},set6:{bg:"#082032",secondary_bg:"#061825",text_color:"#B5D9F3",link_color:"#61bbff",link_hover_color:"#B5D9F3",input_bg:"#0E3755",input_text_color:"#B5D9F3",input_placeholder_color:"#B5D9F3",border_color:"#144E78",btn_text_color:"#B5D9F3",btn_bg:"#144E78",btn_text_hover_color:"#B5D9F3",btn_hover_bg:"#0E3755"},set9:{bg:"#04261d",secondary_bg:"#021e16",text_color:"#C1D2BB",link_color:"#00d29a",link_hover_color:"#C1D2BB",input_bg:"#073d2f",input_text_color:"#C1D2BB",input_placeholder_color:"#C1D2BB",border_color:"#095541",btn_text_color:"#C1D2BB",btn_bg:"#095541",btn_text_hover_color:"#C1D2BB",btn_hover_bg:"#073d2f"},set10:{bg:"#171004",secondary_bg:"#211706",text_color:"#E0D2BD",link_color:"#e09525",link_hover_color:"#E0D2BD",input_bg:"#372911",input_text_color:"#E0D2BD",input_placeholder_color:"#E0D2BD",border_color:"#5D4010",btn_text_color:"#E0D2BD",btn_bg:"#5D4010",btn_text_hover_color:"#E0D2BD",btn_hover_bg:"#372911"}})[e]||a.set1,document.documentElement.style.setProperty("--darkify_dark_mode_bg",e.bg),document.documentElement.style.setProperty("--darkify_dark_mode_secondary_bg",e.secondary_bg),document.documentElement.style.setProperty("--darkify_dark_mode_text_color",e.text_color),document.documentElement.style.setProperty("--darkify_dark_mode_link_color",e.link_color),document.documentElement.style.setProperty("--darkify_dark_mode_link_hover_color",e.link_hover_color),document.documentElement.style.setProperty("--darkify_dark_mode_input_bg",e.input_bg),document.documentElement.style.setProperty("--darkify_dark_mode_input_text_color",e.input_text_color),document.documentElement.style.setProperty("--darkify_dark_mode_input_placeholder_color",e.input_placeholder_color),document.documentElement.style.setProperty("--darkify_dark_mode_border_color",e.border_color),document.documentElement.style.setProperty("--darkify_dark_mode_btn_bg",e.btn_bg),document.documentElement.style.setProperty("--darkify_dark_mode_btn_text_color",e.btn_text_color),document.documentElement.style.setProperty("--darkify_dark_mode_btn_hover_bg",e.btn_hover_bg),document.documentElement.style.setProperty("--darkify_dark_mode_btn_text_hover_color",e.btn_text_hover_color))}document.addEventListener("DOMContentLoaded",function(){darkify_is_block_editor_context()&&darkify_theme_select(localStorage.getItem("darkify_selected_theme")||"set1")});let DARKIFY_IFRAME_THEME_VARS=["--darkify_dark_mode_bg","--darkify_dark_mode_secondary_bg","--darkify_dark_mode_text_color","--darkify_dark_mode_link_color","--darkify_dark_mode_link_hover_color","--darkify_dark_mode_input_bg","--darkify_dark_mode_input_text_color","--darkify_dark_mode_input_placeholder_color","--darkify_dark_mode_border_color","--darkify_dark_mode_btn_bg","--darkify_dark_mode_btn_text_color","--darkify_dark_mode_btn_hover_bg","--darkify_dark_mode_btn_text_hover_color"],darkify_iframe_doc_observers=new WeakMap,darkify_editor_head_watchers=new WeakMap;function darkify_serialize_root_vars(){let r=document.documentElement.style,t=getComputedStyle(document.documentElement),d=":root {";return DARKIFY_IFRAME_THEME_VARS.forEach(function(e){var a=(r.getPropertyValue(e)||t.getPropertyValue(e)).trim();a&&(d+=e+": "+a+";")}),d+"}"}function darkify_iframe_dark_enabled(){return"1"===darkify_is_this_admin_panel||"undefined"==typeof darkify_enable_frontend_iframe_dark_mode||"1"===darkify_enable_frontend_iframe_dark_mode}function darkify_build_theme_payload(){let r=document.documentElement.style,t=getComputedStyle(document.documentElement),d={};return DARKIFY_IFRAME_THEME_VARS.forEach(function(e){var a=(r.getPropertyValue(e)||t.getPropertyValue(e)).trim();a&&(d[e]=a)}),{source:"darkify",type:"darkify-theme",enabled:darkify_iframe_dark_enabled()&&document.documentElement.classList.contains("darkify_dark_mode_enabled"),vars:d}}function darkify_post_theme_to_iframe(e,a){try{var r=e.contentWindow;r&&r.postMessage(a||darkify_build_theme_payload(),"*")}catch(e){}}function darkify_sync_iframe_vars(e){var a=e.head||e.documentElement;let r=e.getElementById("darkify-iframe-vars");r||((r=e.createElement("style")).id="darkify-iframe-vars",a.appendChild(r)),r.textContent=darkify_serialize_root_vars()}function darkify_get_main_css_href(){var e=document.querySelector('link[href*="client_main"]');return e?e.href:null}function darkify_inject_css_into_iframe(e){var a,r,t=e.head||e.documentElement;e.getElementById("darkify-iframe-main-css")||(r=darkify_get_main_css_href())&&((a=e.createElement("link")).id="darkify-iframe-main-css",a.rel="stylesheet",a.href=r,t.appendChild(a)),e.getElementById("darkify-iframe-css")||((r=e.createElement("style")).id="darkify-iframe-css",r.textContent=` |
| 2 |
html.darkify_dark_mode_enabled, |
| 3 |
html.darkify_dark_mode_enabled body { |
| 4 |
background: var(--darkify_dark_mode_secondary_bg) !important; |
| 5 |
color: var(--darkify_dark_mode_text_color) !important; |
| 6 |
} |
| 7 |
|
| 8 |
html.darkify_dark_mode_enabled a { |
| 9 |
color: var(--darkify_dark_mode_link_color) !important; |
| 10 |
} |
| 11 |
html.darkify_dark_mode_enabled a:hover { |
| 12 |
color: var(--darkify_dark_mode_link_hover_color) !important; |
| 13 |
} |
| 14 |
|
| 15 |
html.darkify_dark_mode_enabled input, |
| 16 |
html.darkify_dark_mode_enabled select, |
| 17 |
html.darkify_dark_mode_enabled textarea { |
| 18 |
background: var(--darkify_dark_mode_input_bg) !important; |
| 19 |
color: var(--darkify_dark_mode_input_text_color) !important; |
| 20 |
border-color: var(--darkify_dark_mode_border_color) !important; |
| 21 |
} |
| 22 |
|
| 23 |
html.darkify_dark_mode_enabled input::placeholder, |
| 24 |
html.darkify_dark_mode_enabled textarea::placeholder { |
| 25 |
color: var(--darkify_dark_mode_input_placeholder_color) !important; |
| 26 |
} |
| 27 |
|
| 28 |
/* TinyMCE editor body */ |
| 29 |
html.darkify_dark_mode_enabled body#tinymce, |
| 30 |
html.darkify_dark_mode_enabled .mce-content-body { |
| 31 |
background: var(--darkify_dark_mode_secondary_bg) !important; |
| 32 |
color: var(--darkify_dark_mode_text_color) !important; |
| 33 |
} |
| 34 |
`,t.appendChild(r))}function darkify_inject_block_editor_css_into_iframe(e){var a=e.head||e.documentElement;let r=e.getElementById("darkify-block-editor-css");r||((r=e.createElement("style")).id="darkify-block-editor-css"),r.textContent=` |
| 35 |
/* ── Primary containers (covers all themes) ─────────────────── */ |
| 36 |
html.darkify_dark_mode_enabled, |
| 37 |
html.darkify_dark_mode_enabled body, |
| 38 |
html.darkify_dark_mode_enabled body.editor-styles-wrapper, |
| 39 |
html.darkify_dark_mode_enabled body.block-editor-iframe__body, |
| 40 |
html.darkify_dark_mode_enabled .editor-styles-wrapper, |
| 41 |
html.darkify_dark_mode_enabled .is-root-container, |
| 42 |
html.darkify_dark_mode_enabled .wp-block-post-content, |
| 43 |
html.darkify_dark_mode_enabled .block-editor-block-list__layout, |
| 44 |
html.darkify_dark_mode_enabled .block-editor-iframe__body, |
| 45 |
html.darkify_dark_mode_enabled .wp-site-blocks, |
| 46 |
html.darkify_dark_mode_enabled .entry-content, |
| 47 |
html.darkify_dark_mode_enabled .site-content { |
| 48 |
background: var(--darkify_dark_mode_bg) !important; |
| 49 |
background-color: var(--darkify_dark_mode_bg) !important; |
| 50 |
color: var(--darkify_dark_mode_text_color) !important; |
| 51 |
} |
| 52 |
|
| 53 |
/* ── Override CSS variables used by themes to drive backgrounds ─ |
| 54 |
Kadence: --global-palette9 (bg), --global-palette1 (text) |
| 55 |
WordPress Global Styles: --wp--style--color--background */ |
| 56 |
html.darkify_dark_mode_enabled body { |
| 57 |
--wp--style--color--background: var(--darkify_dark_mode_bg); |
| 58 |
--wp--preset--color--background: var(--darkify_dark_mode_bg); |
| 59 |
--wp--preset--color--base: var(--darkify_dark_mode_bg); |
| 60 |
--wp--preset--color--contrast: var(--darkify_dark_mode_text_color); |
| 61 |
--global-palette9: var(--darkify_dark_mode_bg); |
| 62 |
--global-palette8: var(--darkify_dark_mode_secondary_bg); |
| 63 |
--global-palette7: var(--darkify_dark_mode_secondary_bg); |
| 64 |
--global-palette1: var(--darkify_dark_mode_text_color); |
| 65 |
--global-palette2: var(--darkify_dark_mode_text_color); |
| 66 |
--global-palette3: var(--darkify_dark_mode_link_color); |
| 67 |
--global-palette6: var(--darkify_dark_mode_border_color); |
| 68 |
} |
| 69 |
|
| 70 |
/* ── Text elements ──────────────────────────────────────────── */ |
| 71 |
html.darkify_dark_mode_enabled p, |
| 72 |
html.darkify_dark_mode_enabled h1, |
| 73 |
html.darkify_dark_mode_enabled h2, |
| 74 |
html.darkify_dark_mode_enabled h3, |
| 75 |
html.darkify_dark_mode_enabled h4, |
| 76 |
html.darkify_dark_mode_enabled h5, |
| 77 |
html.darkify_dark_mode_enabled h6, |
| 78 |
html.darkify_dark_mode_enabled li, |
| 79 |
html.darkify_dark_mode_enabled td, |
| 80 |
html.darkify_dark_mode_enabled th, |
| 81 |
html.darkify_dark_mode_enabled blockquote, |
| 82 |
html.darkify_dark_mode_enabled pre, |
| 83 |
html.darkify_dark_mode_enabled span { |
| 84 |
color: var(--darkify_dark_mode_text_color) !important; |
| 85 |
} |
| 86 |
|
| 87 |
/* ── Links ──────────────────────────────────────────────────── */ |
| 88 |
html.darkify_dark_mode_enabled a { |
| 89 |
color: var(--darkify_dark_mode_link_color) !important; |
| 90 |
} |
| 91 |
html.darkify_dark_mode_enabled a:hover { |
| 92 |
color: var(--darkify_dark_mode_link_hover_color) !important; |
| 93 |
} |
| 94 |
|
| 95 |
/* ── Form elements ──────────────────────────────────────────── */ |
| 96 |
html.darkify_dark_mode_enabled input, |
| 97 |
html.darkify_dark_mode_enabled select, |
| 98 |
html.darkify_dark_mode_enabled textarea { |
| 99 |
background: var(--darkify_dark_mode_input_bg) !important; |
| 100 |
color: var(--darkify_dark_mode_input_text_color) !important; |
| 101 |
border-color: var(--darkify_dark_mode_border_color) !important; |
| 102 |
} |
| 103 |
html.darkify_dark_mode_enabled input::placeholder, |
| 104 |
html.darkify_dark_mode_enabled textarea::placeholder { |
| 105 |
color: var(--darkify_dark_mode_input_placeholder_color) !important; |
| 106 |
} |
| 107 |
|
| 108 |
/* ── Blocks ─────────────────────────────────────────────────── */ |
| 109 |
html.darkify_dark_mode_enabled .wp-block { |
| 110 |
color: var(--darkify_dark_mode_text_color) !important; |
| 111 |
} |
| 112 |
html.darkify_dark_mode_enabled img { |
| 113 |
filter: brightness(80%); |
| 114 |
} |
| 115 |
`,a.appendChild(r),darkify_keep_editor_style_last(e,r)}function darkify_keep_editor_style_last(a,r){if(!darkify_editor_head_watchers.has(a)){let e=a.head;var t;e&&((t=new MutationObserver(function(){e.lastElementChild!==r&&e.appendChild(r)})).observe(e,{childList:!0}),darkify_editor_head_watchers.set(a,t))}}function darkify_run_engine_on_iframe(e){function a(){e.querySelectorAll("* :not(head, title, link, meta, script, style, defs, filter, .darkify_processed)").forEach(function(e){try{darkify_process_element(e)}catch(e){}})}var r;a(),darkify_iframe_doc_observers.has(e)||((r=new MutationObserver(a)).observe(e.documentElement,{childList:!0,subtree:!0}),darkify_iframe_doc_observers.set(e,r))}function darkify_apply_filter_to_iframe(e,a){e.style.filter=a?"brightness(0.6)":""}function darkify_is_cross_origin_iframe(e){try{return e.contentDocument||e.contentWindow?.document,!1}catch(e){return!0}}function darkify_apply_dark_to_iframe(r){let t="editor-canvas"===r.name;if("1"!==darkify_is_this_admin_panel||t){let a=document.documentElement.classList.contains("darkify_dark_mode_enabled"),e=function(){let e;try{e=r.contentDocument||r.contentWindow?.document}catch(e){return void(t||"1"===darkify_is_this_admin_panel||darkify_apply_filter_to_iframe(r,document.documentElement.classList.contains("darkify_dark_mode_enabled")))}e&&e.documentElement&&(r.style.filter="",a?(e.documentElement.classList.add("darkify_dark_mode_enabled"),darkify_inject_css_into_iframe(e),darkify_sync_iframe_vars(e),t?darkify_inject_block_editor_css_into_iframe(e):"1"!==darkify_is_this_admin_panel&&darkify_run_engine_on_iframe(e)):e.documentElement.classList.remove("darkify_dark_mode_enabled"))};darkify_post_theme_to_iframe(r),r.dataset.darkifyIframeBound||(r.dataset.darkifyIframeBound="1",r.addEventListener("load",function(){darkify_post_theme_to_iframe(r),e()})),e()}}function darkify_process_iframes(){var e;"1"===darkify_is_this_admin_panel?(e=document.querySelector('iframe[name="editor-canvas"]'))&&darkify_apply_dark_to_iframe(e):darkify_iframe_dark_enabled()&&document.querySelectorAll("iframe").forEach(darkify_apply_dark_to_iframe)}let darkify_parent_theme_observer=null,darkify_iframe_sync_scheduled=!1;function darkify_schedule_iframe_sync(){darkify_iframe_sync_scheduled||(darkify_iframe_sync_scheduled=!0,requestAnimationFrame(function(){darkify_iframe_sync_scheduled=!1,darkify_process_iframes()}))}function darkify_watch_parent_theme(){var e;darkify_parent_theme_observer||((darkify_parent_theme_observer=new MutationObserver(darkify_schedule_iframe_sync)).observe(document.documentElement,{attributes:!0,attributeFilter:["class","style"]}),(e=document.querySelector("style.darkify_inline_css"))&&darkify_parent_theme_observer.observe(e,{childList:!0,characterData:!0,subtree:!0}),"1"===darkify_is_this_admin_panel&&document.body&&new MutationObserver(function(){document.querySelector('iframe[name="editor-canvas"]')&&darkify_schedule_iframe_sync()}).observe(document.body,{childList:!0,subtree:!0}))}function darkify_init_keyboard_shortcut_listener(){"1"===darkify_enable_keyboard_shortcut&&(document.onkeydown=function(e){e.ctrlKey&&e.altKey&&68===e.keyCode&&darkify_switch_trigger()})}function darkify_init_os_mode_change_listener(){"0"===darkify_is_this_admin_panel&&"1"===darkify_enable_os_aware&&window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",e=>{var e=e.matches?"dark":"light",a=document.getElementsByTagName("html")[0];"dark"==e?a.classList.add("darkify_dark_mode_enabled"):"light"==e&&a.classList.remove("darkify_dark_mode_enabled"),darkify_change_state()})}function darkify_init_alternative_dark_mode_switch(){if(0<darkify_alternative_dark_mode_switch.length){var a=document.querySelectorAll(darkify_alternative_dark_mode_switch);for(let e=0;e<a.length;e++)a[e].addEventListener("click",()=>{darkify_switch_trigger()})}}function darkify_init_attention_effect(){var e;"1"===darkify_enable_switch_attention&&darkify_switch_attention_effect&&"none"!==darkify_switch_attention_effect&&(e=document.getElementById("darkify_switch_"+darkify_switch_unique_id))&&e.classList.add("darkify_attention_"+darkify_switch_attention_effect)}function get_bg_color_to_preserve(e,a){let r=window.getComputedStyle(e,null).backgroundColor;return r=("transparent"===(r=a?r:e.dataset.darkify_preserved_bg)||"rgba(0, 0, 0, 0)"===r||"rgba(255,255,255,0)"===r)&&1===e.parentNode.nodeType||1===e.parentNode.nodeType&&e.parentNode.hasAttribute("data-darkify_preserved_bg")&&window.getComputedStyle(e.parentNode,null).backgroundColor===r?get_bg_color_to_preserve(e.parentNode,!1):r}function get_txt_color_to_preserve(e,a){let r=window.getComputedStyle(e,null).color;return r=("transparent"===(r=a?r:e.dataset.darkify_preserved_color)||"rgba(0, 0, 0, 0)"===r||"rgba(255,255,255,0)"===r)&&1===e.parentNode.nodeType||1===e.parentNode.nodeType&&e.parentNode.hasAttribute("data-darkify_preserved_color")&&window.getComputedStyle(e.parentNode,null).color===r?get_txt_color_to_preserve(e.parentNode,!1):r}function darkify_darken_bg_image(a,r){if(document.getElementsByTagName("html")[0].classList.contains("darkify_dark_mode_enabled")){var t=window.getComputedStyle(a,null),d=window.getComputedStyle(a,":before"),_=window.getComputedStyle(a,":after");if("none"!==t.backgroundImage&&t.backgroundImage.includes("url")&&!t.backgroundImage.includes("rgba(0, 0, 0, "+r+")")&&a.style.setProperty("background-image","linear-gradient(rgba(0, 0, 0, "+r+"), rgba(0, 0, 0, "+r+")), "+t.backgroundImage),"none"!==d.backgroundImage&&d.backgroundImage.includes("url")&&!d.backgroundImage.includes("rgba(0, 0, 0, "+r+")")){t="darkify-before-"+Math.random().toString(36).substr(2,9);a.setAttribute("data-darkify-style-id",t);let e=document.getElementById(t);e||((e=document.createElement("style")).id=t,document.head.appendChild(e)),a.dataset.darkifyOriginalBeforeBg=d.backgroundImage;t=` |
| 116 |
.darkify_dark_mode_enabled [data-darkify-style-id="${t}"]::before { |
| 117 |
background-image: linear-gradient(rgba(0, 0, 0, ${r}), rgba(0, 0, 0, ${r})), ${d.backgroundImage} !important; |
| 118 |
} |
| 119 |
`;e.textContent=t,"static"===window.getComputedStyle(a).position&&(a.style.position="relative")}if("none"!==_.backgroundImage&&_.backgroundImage.includes("url")&&!_.backgroundImage.includes("rgba(0, 0, 0, "+r+")")){d="darkify-after-"+Math.random().toString(36).substr(2,9);a.setAttribute("data-darkify-style-id",d);let e=document.getElementById(d);e||((e=document.createElement("style")).id=d,document.head.appendChild(e)),a.dataset.darkifyOriginalAfterBg=_.backgroundImage;t=` |
| 120 |
.darkify_dark_mode_enabled [data-darkify-style-id="${d}"]::after { |
| 121 |
background-image: linear-gradient(rgba(0, 0, 0, ${r}), rgba(0, 0, 0, ${r})), ${_.backgroundImage} !important; |
| 122 |
} |
| 123 |
`;e.textContent=t,"static"===window.getComputedStyle(a).position&&(a.style.position="relative")}}else"none"!==window.getComputedStyle(a,null).backgroundImage&&window.getComputedStyle(a,null).backgroundImage.includes("rgba(0, 0, 0, "+r+")")&&a.style.setProperty("background-image",window.getComputedStyle(a,null).backgroundImage.replace("linear-gradient(rgba(0, 0, 0, "+r+"), rgba(0, 0, 0, "+r+")), ",""))}function darkify_img_brightness_and_grayscale(e){document.getElementsByTagName("html")[0].classList.contains("darkify_dark_mode_enabled")?e.classList.contains("darkify_changed_brightness_and_grayscale")||(e.dataset.darkify_preserved_filter=e.style.filter,e.classList.add("darkify_changed_brightness_and_grayscale"),"1"===darkify_enable_low_image_brightness&&"1"===darkify_enable_image_grayscale?e.style.filter="brightness("+darkify_image_brightness_to+"%) grayscale("+darkify_image_grayscale_to+"%)":"1"===darkify_enable_low_image_brightness?e.style.filter="brightness("+darkify_image_brightness_to+"%)":"1"===darkify_enable_image_grayscale&&(e.style.filter="grayscale("+darkify_image_grayscale_to+"%)")):e.classList.contains("darkify_changed_brightness_and_grayscale")&&(e.style.filter=e.dataset.darkify_preserved_filter,e.classList.remove("darkify_changed_brightness_and_grayscale"),delete e.dataset.darkify_preserved_filter)}function darkify_invert_inline_svg(e){document.body.classList.contains("block-editor-page")||(document.getElementsByTagName("html")[0].classList.contains("darkify_dark_mode_enabled")?(e.style.filter="invert(1)",e.classList.add("darkify_inverted_inline_svg")):e.classList.contains("darkify_inverted_inline_svg")&&(e.style.filter=e.style.filter.replace("invert(1)",""),e.classList.remove("darkify_inverted_inline_svg")))}function darkify_video_brightness_and_grayscale(e){document.getElementsByTagName("html")[0].classList.contains("darkify_dark_mode_enabled")?e.classList.contains("darkify_changed_video_brightness_and_grayscale")||(e.dataset.darkify_preserved_filter=e.style.filter,e.classList.add("darkify_changed_video_brightness_and_grayscale"),"1"===darkify_enable_low_video_brightness&&"1"===darkify_enable_video_grayscale?e.style.filter="brightness("+darkify_video_brightness_to+"%) grayscale("+darkify_video_grayscale_to+"%)":"1"===darkify_enable_low_video_brightness?e.style.filter="brightness("+darkify_video_brightness_to+"%)":"1"===darkify_enable_video_grayscale&&(e.style.filter="grayscale("+darkify_video_grayscale_to+"%)")):e.classList.contains("darkify_changed_video_brightness_and_grayscale")&&(e.style.filter=e.dataset.darkify_preserved_filter,e.classList.remove("darkify_changed_video_brightness_and_grayscale"),delete e.dataset.darkify_preserved_filter)}function darkify_replace_video(a,r){if(document.getElementsByTagName("html")[0].classList.contains("darkify_dark_mode_enabled"))for(let e=0;e<r.length;e++){var t=r[e].normal_video,d=new URL(t).pathname,_=r[e].dark_video;new URL(_).pathname;if(null!=a.getAttribute("src")&&a.getAttribute("src").includes(d)&&(a.src=_,a.classList.add("darkify_replaced_video")),null!=a.querySelectorAll("source")){var i=a.querySelectorAll("source");for(let e=0;e<i.length;e++)null!=i[e].getAttribute("src")&&i[e].getAttribute("src").includes(d)&&(i[e].src=_+"?_="+Date.now(),a.classList.add("darkify_replaced_video"),a.load())}}else if(a.classList.contains("darkify_replaced_video"))for(let e=0;e<r.length;e++){var o=r[e].normal_video,n=(new URL(o).pathname,r[e].dark_video),s=new URL(n).pathname;if(null!=a.getAttribute("src")&&a.getAttribute("src").includes(s)&&(a.src=o,a.classList.remove("darkify_replaced_video")),null!=a.querySelectorAll("source")){var l=a.querySelectorAll("source");for(let e=0;e<l.length;e++)null!=l[e].getAttribute("src")&&l[e].getAttribute("src").includes(s)&&(l[e].src=o+"?_="+Date.now(),a.classList.remove("darkify_replaced_video"),a.load())}}}function darkify_process_pseudo_bg(e){var a=e=>!e||"transparent"===e||"rgba(0, 0, 0, 0)"===e||"rgba(255, 255, 255, 0)"===e,r=window.getComputedStyle(e,"::before").backgroundColor,t=window.getComputedStyle(e,"::after").backgroundColor;a(r)||e.setAttribute("data-darkify-pseudo-before-bg",r),a(t)||e.setAttribute("data-darkify-pseudo-after-bg",t)}function darkify_apply_pseudo_bg_styles(){document.querySelectorAll("[data-darkify-pseudo-before-bg], [data-darkify-pseudo-after-bg]").forEach(e=>{var a=e.hasAttribute("data-darkify-pseudo-before-bg"),r=e.hasAttribute("data-darkify-pseudo-after-bg");let t=e.getAttribute("data-darkify-pseudo-bg-id"),d=(t||(t="dkf-"+Math.random().toString(36).substr(2,9),e.setAttribute("data-darkify-pseudo-bg-id",t)),document.getElementById("darkify-pseudo-bg-"+t)),_=(d||((d=document.createElement("style")).id="darkify-pseudo-bg-"+t,document.head.appendChild(d)),"");a&&(a=e.getAttribute("data-darkify-pseudo-before-bg"),a=""!==darkify_secondary_bg_color&&a!==darkify_secondary_bg_color?"--darkify_dark_mode_secondary_bg":"--darkify_dark_mode_bg",_+=` |
| 124 |
.darkify_dark_mode_enabled [data-darkify-pseudo-bg-id="${t}"]::before { |
| 125 |
background: var(${a}) !important; |
| 126 |
background-color: var(${a}) !important; |
| 127 |
} |
| 128 |
`),r&&(a=e.getAttribute("data-darkify-pseudo-after-bg"),r=""!==darkify_secondary_bg_color&&a!==darkify_secondary_bg_color?"--darkify_dark_mode_secondary_bg":"--darkify_dark_mode_bg",_+=` |
| 129 |
.darkify_dark_mode_enabled [data-darkify-pseudo-bg-id="${t}"]::after { |
| 130 |
background: var(${r}) !important; |
| 131 |
background-color: var(${r}) !important; |
| 132 |
} |
| 133 |
`),d.textContent=_})}function darkify_fix_background_color_alpha(e){var a,r;document.getElementsByTagName("html")[0].classList.contains("darkify_dark_mode_enabled")?e.hasAttribute("data-darkify_alpha_bg")&&(a=e.dataset.darkify_alpha_bg.replace("rgba(","").replace(")","").split(",")[3].trim(),(r=window.getComputedStyle(e,null).backgroundColor).includes("rgba")||e.style.setProperty("background-color",r.replace(")",", "+a+")").replace("rgb","rgba"),"important")):e.hasAttribute("data-darkify_alpha_bg")&&(e.style.backgroundColor="")}function darkify_implement_secondary_bg(){let a=null,r=0;var t=document.querySelectorAll("* :not(head, title, link, meta, script, style, defs, filter)");for(let e=0;e<t.length;e++){var d,_=t[e];_.hasAttribute("data-darkify_secondary_bg_finder")&&"transparent"!==(d=_.dataset.darkify_secondary_bg_finder)&&"rgba(0, 0, 0, 0)"!==d&&(_=(_=_.getBoundingClientRect()).width*_.height)>r&&(r=_,a=d)}for(let e=0;e<t.length;e++){var i=t[e];i.hasAttribute("data-darkify_secondary_bg_finder")&&((i.classList.contains("darkify_style_all")||i.classList.contains("darkify_style_bg_txt")||i.classList.contains("darkify_style_bg_border")||i.classList.contains("darkify_style_bg"))&&a!==i.dataset.darkify_secondary_bg_finder&&i.classList.add("darkify_style_secondary_bg"),delete i.dataset.darkify_secondary_bg_finder)}darkify_secondary_bg_color=a}function darkify_recheck_on_css_loaded_later(){document.querySelectorAll(".darkify_style_txt_border, .darkify_style_txt, .darkify_style_border").forEach(function(e){var a=window.getComputedStyle(e,null).backgroundColor;"rgba(0, 0, 0, 0)"!==a&&"rgba(255, 255, 255, 0)"!==a&&darkify_process_element(e)})}function darkify_check_preloading(){let e=!1;var a,r,t,d=localStorage.darkify_last_state||"not_set";return"1"===darkify_is_this_admin_panel?"1"===(localStorage.darkify_admin_panel_last_state||"not_set")&&(e=!0):"1"===d||"0"===d?"1"===d&&(e=!0):("1"===darkify_enable_default_dark_mode&&(e=!0),"1"===darkify_enable_time_based_dark&&(a=new Date,r=new Date,t=new Date,r.setHours(parseInt(darkify_time_based_dark_start.split(":")[0])),r.setMinutes(parseInt(darkify_time_based_dark_start.split(":")[1])),t.setHours(parseInt(darkify_time_based_dark_stop.split(":")[0])),t.setMinutes(parseInt(darkify_time_based_dark_stop.split(":")[1])),parseInt(darkify_time_based_dark_stop.split(":")[0])>=parseInt(darkify_time_based_dark_start.split(":")[0])?a.getTime()>r.getTime()&&a.getTime()<t.getTime()&&(e=!0):12<a.getHours()?a.getTime()>r.getTime()&&a.getTime()>t.getTime()&&(e=!0):a.getTime()<r.getTime()&&a.getTime()<t.getTime()&&(e=!0))),e="0"===darkify_is_this_admin_panel&&"1"===darkify_enable_os_aware&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches&&"1"!==d&&"0"!==d?!0:e}function darkify_process_element(a){var e,r=window.getComputedStyle(a,null),t=((a.classList.contains("darkify_style_all")||a.classList.contains("darkify_style_bg_txt")||a.classList.contains("darkify_style_bg_border")||a.classList.contains("darkify_style_txt_border")||a.classList.contains("darkify_style_bg")||a.classList.contains("darkify_style_txt")||a.classList.contains("darkify_style_border")||a.classList.contains("darkify_style_secondary_bg"))&&(a.classList.remove("darkify_style_all"),a.classList.remove("darkify_style_bg_txt"),a.classList.remove("darkify_style_bg_border"),a.classList.remove("darkify_style_txt_border"),a.classList.remove("darkify_style_bg"),a.classList.remove("darkify_style_txt"),a.classList.remove("darkify_style_border"),a.classList.remove("darkify_style_secondary_bg")),a.nodeName.toLowerCase()),d=r.backgroundColor,_=r.color,i=r.borderColor,r=r.backgroundImage;"body"!==t||"rgba(0, 0, 0, 0)"!==d&&"rgba(255, 255, 255, 0)"!==d||(a.style.setProperty("background-color","rgb(255, 255, 255)"),d=window.getComputedStyle(a,null).backgroundColor),0<darkify_disallowed_elements.length&&a.matches(darkify_disallowed_elements)||(e=!1,"none"!==r&&r.includes("url")&&(e=!0,"1"===darkify_enable_bg_image_darken)&&darkify_darken_bg_image(a,darken_level),"rgba(0, 0, 0, 0)"===d||"rgba(255, 255, 255, 0)"===d||e||(a.hasAttribute("data-darkify_secondary_bg_finder")||(a.dataset.darkify_secondary_bg_finder=d),""!==darkify_secondary_bg_color&&(darkify_secondary_bg_color!==a.dataset.darkify_secondary_bg_finder&&a.classList.add("darkify_style_secondary_bg"),delete a.dataset.darkify_secondary_bg_finder)),"rgba(0, 0, 0, 0)"!==d&&"rgba(0, 0, 0, 0)"!==_&&"rgba(0, 0, 0, 0)"!==i&&"rgba(255, 255, 255, 0)"!==d&&"rgba(255, 255, 255, 0)"!==_&&"rgba(255, 255, 255, 0)"!==i&&!1===e?a.classList.add("darkify_style_all"):"rgba(0, 0, 0, 0)"!==d&&"rgba(0, 0, 0, 0)"!==_&&"rgba(255, 255, 255, 0)"!==d&&"rgba(255, 255, 255, 0)"!==_&&!1===e?a.classList.add("darkify_style_bg_txt"):"rgba(0, 0, 0, 0)"!==d&&"rgba(0, 0, 0, 0)"!==i&&"rgba(255, 255, 255, 0)"!==d&&"rgba(255, 255, 255, 0)"!==i&&!1===e?a.classList.add("darkify_style_bg_border"):"rgba(0, 0, 0, 0)"!==_&&"rgba(0, 0, 0, 0)"!==i&&"rgba(255, 255, 255, 0)"!==_&&"rgba(255, 255, 255, 0)"!==i?a.classList.add("darkify_style_txt_border"):"rgba(0, 0, 0, 0)"!==d&&"rgba(255, 255, 255, 0)"!==d&&!1===e?a.classList.add("darkify_style_bg"):"rgba(0, 0, 0, 0)"!==_&&"rgba(255, 255, 255, 0)"!==_?a.classList.add("darkify_style_txt"):"rgba(0, 0, 0, 0)"!==i&&"rgba(255, 255, 255, 0)"!==i&&a.classList.add("darkify_style_border"),"none"===r||e||a.classList.contains("darkify_style_all")||a.classList.contains("darkify_style_bg_txt")||a.classList.contains("darkify_style_bg_border")||a.classList.contains("darkify_style_bg")||a.classList.add("darkify_style_secondary_bg"),"a"===t&&a.classList.add("darkify_style_link"),"input"!==t&&"select"!==t&&"textarea"!==t||a.classList.add("darkify_style_form_element"),_=darkify_allowed_btn_class.some(e=>a.classList.contains(e)),"button"!==t&&!_&&"submit"!==a.type||(a.classList.add("darkify_style_button"),a.classList.remove("darkify_style_secondary_bg"),a.classList.remove("darkify_style_all"),a.classList.remove("darkify_style_link")),"1"!==darkify_enable_low_image_brightness&&"1"!==darkify_enable_image_grayscale||"img"!==t||darkify_img_brightness_and_grayscale(a),"1"===darkify_enable_invert_inline_svg&&"svg"===t&&darkify_invert_inline_svg(a),"1"!==darkify_enable_low_video_brightness&&"1"!==darkify_enable_video_grayscale||("video"===t&&darkify_video_brightness_and_grayscale(a),"iframe"===t&&null!==(i=a.getAttribute("src"))&&(i.includes("youtube")||i.includes("vimeo")||i.includes("dailymotion"))&&darkify_video_brightness_and_grayscale(a)),d.includes("rgba")&&(a.dataset.darkify_alpha_bg=d,darkify_fix_background_color_alpha(a)),darkify_process_pseudo_bg(a),setTimeout(function(){elements_class_changed.observe(a,{attributes:!0,attributeFilter:["class"]})},0),a.classList.add("darkify_processed"))}function darkify_init_processes(){has_process_run_at_least_once=!0,document.querySelectorAll("* :not(head, title, link, meta, script, style, defs, filter, .darkify_processed)").forEach(function(e){darkify_process_element(e)})}function darkify_init_observer(){darkify_observer.observe(document,{attributes:!1,childList:!0,characterData:!1,subtree:!0}),dark_mode_status_changed.observe(document.getElementsByTagName("html")[0],{attributes:!0}),"loading"!==document.readyState?(has_process_run_at_least_once||darkify_init_processes(),darkify_implement_secondary_bg(),darkify_apply_pseudo_bg_styles(),darkify_recheck_on_css_loaded_later(),darkify_restore_selected_theme()):document.addEventListener("DOMContentLoaded",function(){has_process_run_at_least_once||darkify_init_processes(),darkify_implement_secondary_bg(),darkify_apply_pseudo_bg_styles(),darkify_recheck_on_css_loaded_later(),darkify_restore_selected_theme()})}_dkf_iframe_disabled||("loading"!==document.readyState?darkify_watch_parent_theme():document.addEventListener("DOMContentLoaded",darkify_watch_parent_theme)),window.addEventListener("message",function(e){var a=e.data;if(a&&"darkify"===a.source&&"darkify-request-theme"===a.type)try{e.source&&e.source.postMessage(darkify_build_theme_payload(),"*")}catch(e){}}),!_dkf_iframe_disabled&&darkify_check_preloading()&&(document.getElementsByTagName("html")[0].classList.add("darkify_dark_mode_enabled"),darkify_init_observer(),darkify_process_iframes()),"loading"!==document.readyState?darkify_restore_selected_theme():document.addEventListener("DOMContentLoaded",darkify_restore_selected_theme); |