Changeset 3478278
- Timestamp:
- 03/09/2026 03:36:07 PM (3 weeks ago)
- Location:
- image-watermark/tags/2.0.9
- Files:
-
- 5 deleted
- 21 copied
-
. (copied) (copied from image-watermark/trunk)
-
1.6.3 (deleted)
-
css/admin-settings.css (copied) (copied from image-watermark/trunk/css/admin-settings.css)
-
css/admin.css (copied) (copied from image-watermark/trunk/css/admin.css)
-
css/image-watermark.css (deleted)
-
css/images (deleted)
-
css/wp-like-ui-theme.css (deleted)
-
fonts (copied) (copied from image-watermark/trunk/fonts)
-
image-watermark.php (copied) (copied from image-watermark/trunk/image-watermark.php) (4 diffs)
-
images/df-black-sm.png (copied) (copied from image-watermark/trunk/images/df-black-sm.png)
-
images/logo-dfactory.png (deleted)
-
includes/class-actions-controller.php (copied) (copied from image-watermark/trunk/includes/class-actions-controller.php) (1 diff)
-
includes/class-settings-api.php (copied) (copied from image-watermark/trunk/includes/class-settings-api.php)
-
includes/class-settings.php (copied) (copied from image-watermark/trunk/includes/class-settings.php)
-
includes/class-update.php (copied) (copied from image-watermark/trunk/includes/class-update.php)
-
includes/class-upload-handler.php (copied) (copied from image-watermark/trunk/includes/class-upload-handler.php) (2 diffs)
-
index.php (copied) (copied from image-watermark/trunk/index.php)
-
js/admin-classic-editor.js (copied) (copied from image-watermark/trunk/js/admin-classic-editor.js)
-
js/admin-image-actions.js (copied) (copied from image-watermark/trunk/js/admin-image-actions.js) (1 diff)
-
js/admin-media.js (copied) (copied from image-watermark/trunk/js/admin-media.js)
-
js/admin-notice.js (copied) (copied from image-watermark/trunk/js/admin-notice.js)
-
js/admin-settings.js (copied) (copied from image-watermark/trunk/js/admin-settings.js)
-
js/admin-upload.js (copied) (copied from image-watermark/trunk/js/admin-upload.js)
-
js/no-right-click.js (copied) (copied from image-watermark/trunk/js/no-right-click.js)
-
languages/image-watermark.pot (copied) (copied from image-watermark/trunk/languages/image-watermark.pot)
-
readme.txt (copied) (copied from image-watermark/trunk/readme.txt) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
image-watermark/tags/2.0.9/image-watermark.php
r3458905 r3478278 3 3 Plugin Name: Image Watermark 4 4 Description: Secure and brand your images with automatic watermarks. Apply image or text overlays to new uploads and bulk process existing Media Library images with ease. 5 Version: 2.0. 85 Version: 2.0.9 6 6 Author: dFactory 7 7 Author URI: http://www.dfactory.co/ … … 13 13 14 14 Image Watermark 15 Copyright (C) 2013-202 5, Digital Factory - info@digitalfactory.pl15 Copyright (C) 2013-2026, Digital Factory - info@digitalfactory.pl 16 16 17 17 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: … … 30 30 * 31 31 * @class Image_Watermark 32 * @version 2.0. 832 * @version 2.0.9 33 33 */ 34 34 final class Image_Watermark { … … 101 101 ] 102 102 ], 103 'version' => '2.0. 8'103 'version' => '2.0.9' 104 104 ]; 105 105 public $options = []; -
image-watermark/tags/2.0.9/includes/class-actions-controller.php
r3449988 r3478278 249 249 } 250 250 251 $should_exit = apply_filters( 'iw_bulk_action_should_exit', true, $location, $action, $post_ids ); 252 253 if ( ! $should_exit ) { 254 return $location; 255 } 256 251 257 wp_redirect( $location ); 252 258 exit; -
image-watermark/tags/2.0.9/includes/class-upload-handler.php
r3458905 r3478278 60 60 public function handle_upload_files( $file ) { 61 61 if ( ! $this->plugin->get_extension() ) { 62 return $file; 63 } 64 65 $script_filename = isset( $_SERVER['SCRIPT_FILENAME'] ) ? $_SERVER['SCRIPT_FILENAME'] : ''; 66 67 if ( wp_doing_ajax() ) { 68 $ref = ''; 69 70 if ( ! empty( $_REQUEST['_wp_http_referer'] ) ) { 71 $ref = wp_unslash( $_REQUEST['_wp_http_referer'] ); 72 } elseif ( ! empty( $_SERVER['HTTP_REFERER'] ) ) { 73 $ref = wp_unslash( $_SERVER['HTTP_REFERER'] ); 74 } 75 76 if ( ( strpos( $ref, admin_url() ) === false ) && ( basename( $script_filename ) === 'admin-ajax.php' ) ) { 77 $this->is_admin = false; 78 } else { 79 $this->is_admin = true; 80 } 81 } else { 82 $this->is_admin = is_admin(); 83 } 62 $this->plugin->check_extensions(); 63 64 if ( ! $this->plugin->get_extension() ) { 65 return $file; 66 } 67 } 68 69 $this->is_admin = $this->is_admin_upload_request(); 84 70 85 71 $upload_context = isset( $_REQUEST['iw_watermark_upload'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['iw_watermark_upload'] ) ) : ''; … … 139 125 140 126 return $file; 127 } 128 129 /** 130 * Determine whether the current upload should follow admin automatic watermark rules. 131 * 132 * @return bool 133 */ 134 private function is_admin_upload_request() { 135 $script_filename = isset( $_SERVER['SCRIPT_FILENAME'] ) ? (string) $_SERVER['SCRIPT_FILENAME'] : ''; 136 $ref = $this->get_request_referer(); 137 138 if ( $this->is_rest_admin_media_upload( $ref ) ) { 139 return true; 140 } 141 142 if ( wp_doing_ajax() ) { 143 if ( ( strpos( $ref, admin_url() ) === false ) && ( basename( $script_filename ) === 'admin-ajax.php' ) ) { 144 return false; 145 } 146 147 return true; 148 } 149 150 return is_admin(); 151 } 152 153 /** 154 * Get the current request referer. 155 * 156 * @return string 157 */ 158 private function get_request_referer() { 159 if ( ! empty( $_REQUEST['_wp_http_referer'] ) ) { 160 return (string) wp_unslash( $_REQUEST['_wp_http_referer'] ); 161 } 162 163 if ( ! empty( $_SERVER['HTTP_REFERER'] ) ) { 164 return (string) wp_unslash( $_SERVER['HTTP_REFERER'] ); 165 } 166 167 return ''; 168 } 169 170 /** 171 * Detect REST media uploads that originate from wp-admin screens such as Gutenberg. 172 * 173 * @param string $ref Request referer. 174 * @return bool 175 */ 176 private function is_rest_admin_media_upload( $ref ) { 177 if ( ! ( defined( 'REST_REQUEST' ) && REST_REQUEST ) ) { 178 return false; 179 } 180 181 $request_uri = isset( $_SERVER['REQUEST_URI'] ) ? (string) wp_unslash( $_SERVER['REQUEST_URI'] ) : ''; 182 $rest_media_route = '/' . rest_get_url_prefix() . '/wp/v2/media'; 183 184 if ( strpos( $request_uri, $rest_media_route ) === false ) { 185 return false; 186 } 187 188 return ( $ref !== '' && strpos( $ref, admin_url() ) !== false ); 141 189 } 142 190 -
image-watermark/tags/2.0.9/js/admin-image-actions.js
r3448189 r3478278 1 (function(){"use strict";(()=>{const d=window.iwArgsImageActions||{},k=Array.isArray(d.allowed_mimes)&&d.allowed_mimes.length?d.allowed_mimes:null,h=(t,e=document)=>(e||document).querySelector(t),p=(t,e=document)=>Array.prototype.slice.call((e||document).querySelectorAll(t)),B=(t,e)=>{if(!t)return!1;const n=t.matches||t.msMatchesSelector||t.webkitMatchesSelector;return n?n.call(t,e):!1},g=(t,e)=>{let n=t;for(;n;){if(B(n,e))return n;n=n.parentElement}return null},w=t=>!!(t&&(t.offsetWidth||t.offsetHeight||t.getClientRects().length)),y=()=>p(".iw-notice").forEach(t=>t.remove()),I=()=>p(".iw-overlay").forEach(t=>t.remove()),v=t=>Object.keys(t).map(e=>`${encodeURIComponent(e)}=${encodeURIComponent(t[e])}`).join("&"),A=(t,e)=>new Promise((n,i)=>{if(window.fetch){window.fetch(t,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},body:e}).then(s=>s.json()).then(n).catch(i);return}const a=new XMLHttpRequest;a.open("POST",t,!0),a.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),a.onreadystatechange=function(){if(a.readyState===4)if(a.status>=200&&a.status<300)try{n(JSON.parse(a.responseText))}catch( l){i(l)}else i(new Error("Request failed"))},a.send(e)}),c={running:!1,actionLocation:"",action:"",response:"",selected:[],successCount:0,skippedCount:0,gridButtonsBound:!1,gridFrame:null,gridButtons:[],gridDomInterval:null,attachmentInfoToken:0,isGridSelectModeActive(){const t=h(".select-mode-toggle-button");if(t&&((t.getAttribute("aria-pressed")||t.getAttribute("aria-checked"))==="true"||t.classList&&(t.classList.contains("active")||t.classList.contains("is-pressed"))))return!0;const e=h(".attachments-browser");if(e&&(e.classList.contains("mode-select")||e.classList.contains("is-attachment-select-mode")||e.classList.contains("select-mode")))return!0;const n=h(".media-frame");return!!(n&&(n.classList.contains("mode-select")||n.classList.contains("select-mode"))||p(".attachments-browser .attachments .attachment.selected").length)},init(){document.addEventListener("click",t=>{const e=g(t.target,".bulkactions input#doaction, .bulkactions input#doaction2");if(!e)return;const n=g(e,".bulkactions"),i=n?n.querySelector("select"):null,a=i?i.value:"";if(!(!a||!d.backup_image&&a==="removewatermark")&&(a==="applywatermark"||a==="removewatermark")){if(t.preventDefault(),c.running){c.notice("iw-notice error",d.__running,!1);return}c.running=!0,c.action=a,c.actionLocation="upload-list",c.selected=p('.wp-list-table .check-column input[type="checkbox"]:checked').map(s=>s.value),y(),c.postLoop()}}),document.addEventListener("click",t=>{const e=g(t.target,".iw-notice.is-dismissible .notice-dismiss");if(e){const n=g(e,".iw-notice");n&&n.remove()}}),this.initGridMode()},initGridMode(){if(this.gridButtonsBound||typeof wp=="undefined"||!wp.media||typeof window.iwArgsMedia=="undefined")return;const t=i=>{this.gridButtonsBound=!0,this.gridFrame=i,i.on("ready",this.renderGridButtons),i.on("select:activate",this.renderGridButtons),i.on("select:deactivate",this.hideGridButtons),i.on("selection:toggle selection:action:done library:selection:add",this.updateGridButtonsState),i.on("attachments:selected",this.updateAttachmentInfoActions),i.on("selection:change",this.updateAttachmentInfoActions),i.on("toolbar:render:details",this.updateAttachmentInfoActions),i.on("content:render",this.updateAttachmentInfoActions),this.renderGridButtons(),this.updateAttachmentInfoActions()},e=()=>{const i=wp.media&&(wp.media.frame||wp.media.frames&&(wp.media.frames.browse||wp.media.frames.manage));return i&&typeof i.on=="function"?(t(i),!0):!1};if(!e()){const i=setInterval(()=>{e()&&clearInterval(i)},300)}new MutationObserver(i=>{i.forEach(a=>{a.addedNodes.forEach(s=>{s.nodeType===Node.ELEMENT_NODE&&(s.matches(".attachment-info")||s.querySelector(".attachment-info"))&&c.updateAttachmentInfoActions()})})}).observe(document.body,{childList:!0,subtree:!0}),document.addEventListener("click",i=>{g(i.target,".select-mode-toggle-button")&&(this.renderGridButtons(),this.gridDomInterval&&clearInterval(this.gridDomInterval),this.gridDomInterval=setInterval(()=>{this.renderGridButtons()},400),setTimeout(()=>{this.gridDomInterval&&(clearInterval(this.gridDomInterval),this.gridDomInterval=null)},3e3))}),document.addEventListener("click",i=>{g(i.target,".attachments-browser .attachment, .attachments-browser .attachment .check")&&setTimeout(this.updateGridButtonsState,50)})},ensureGridButtonsDom(){if(h(".media-modal"))return!1;const e=(()=>{const o=[".media-frame.mode-grid .media-frame-toolbar .media-toolbar",".media-frame.mode-grid .media-toolbar",".media-frame .media-frame-toolbar .media-toolbar",".attachments-browser .media-toolbar",".attachments-browser .attachments-filters"];for(let m=0;m<o.length;m++){const u=p(o[m]);for(let f=0;f<u.length;f++)if(w(u[f]))return u[f]}return null})();if(!e)return!1;const n=(()=>{const o=p(".media-toolbar-primary",e);for(let u=0;u<o.length;u++)if(w(o[u]))return o[u];const m=p(".media-toolbar-secondary",e);for(let u=0;u<m.length;u++)if(w(m[u]))return m[u];return e})();if(!n)return!1;n.style.overflow="visible",p(".iw-grid-watermark-apply, .iw-grid-watermark-remove",n).forEach(o=>o.remove());const i=(o,m,u)=>{const f=document.createElement("button");return f.type="button",f.className=`button media-button ${o}`,f.textContent=m,f.addEventListener("click",()=>this.startGridAction(u)),f},a=(()=>{const o=p(".select-mode-toggle-button",n);for(let m=0;m<o.length;m++)if(w(o[m]))return o[m];return null})(),s=i("iw-grid-watermark-apply",window.iwArgsMedia.applyWatermark,"applywatermark"),l=a||n.firstChild||null;n.insertBefore(s,l);const r=[s];if(d.backup_image){const o=i("iw-grid-watermark-remove",window.iwArgsMedia.removeWatermark,"removewatermark");n.insertBefore(o,l),r.push(o)}return this.gridButtons=r,this.hideGridButtons(),!0},renderGridButtons:()=>{if(c.ensureGridButtonsDom()){if(!c.isGridSelectModeActive()){c.hideGridButtons();return}c.gridButtons.forEach(t=>{t.style.display=""}),c.updateGridButtonsState()}},hideGridButtons:()=>{c.gridButtons.forEach(t=>{t.disabled=!0,t.style.display="none"})},updateGridButtonsState:()=>{if(!c.gridButtons.length)return;if(!c.isGridSelectModeActive()){c.hideGridButtons();return}const t=c.collectSelectionIds(),e=c.running||t.length===0;c.gridButtons.forEach(n=>{n&&(n.disabled=e||n.classList.contains("iw-grid-watermark-remove")&&!d.backup_image)})},runAttachmentAction:(t,e,n)=>{if(c.running)return;const i=p(".iw-attachment-action");i.forEach(l=>l.classList.add("disabled")),n&&(n.textContent=d.single_running,n.className="iw-attachment-status");const a=v({_iw_nonce:d._nonce,action:"iw_watermark_bulk_action","iw-action":t,attachment_id:e}),s=()=>{i.forEach(l=>l.classList.remove("disabled")),c.running=!1};c.running=!0,A(window.ajaxurl||"/wp-admin/admin-ajax.php",a).then(l=>{if(l&&l.success===!0&&(l.data==="watermarked"||l.data==="watermarkremoved")){const m=t==="applywatermark"?d.single_applied:d.single_removed;n&&(n.textContent=m,n.className="iw-attachment-status success"),c.refreshAttachmentThumb(e);return}let o=d.single_error;l&&typeof l.data=="string"&&(o=l.data==="skipped"?d.single_skipped||d.__skipped||o:l.data),n&&(n.textContent=o,n.className="iw-attachment-status error")}).then(s)},updateAttachmentInfoActions:()=>{p(".media-modal .iw-attachment-action, .media-modal .iw-separator, .media-modal .iw-watermark-setting").forEach(r=>r.remove()),c.attachmentInfoToken+=1;const t=c.attachmentInfoToken,e=h(".media-modal #image_watermark_buttons"),n=c.gridFrame&&c.gridFrame.state?c.gridFrame.state().get("selection"):null,i=n&&n.first?n.first():null,a=()=>i&&typeof i.get=="function"?i.get("id"):e?e.getAttribute("data-id"):null,s=()=>i?c.isSupportedModel(i):!0,l=(r=0)=>{if(t!==c.attachmentInfoToken)return;const o=h('.media-modal .attachment-details .setting[data-setting="url"]')||h('.media-modal .attachment-info .setting[data-setting="url"]'),m=a();if(!m||!s()||o&&g(o,".iw-is-watermark-selector"))return;if(!o){r<20&&setTimeout(()=>l(r+1),100);return}o.parentElement&&o.parentElement.querySelector(".iw-watermark-setting")||c.injectAttachmentActions(o,m)};l()},injectAttachmentActions:(t,e)=>{if(!e||!t)return;const n=t.parentElement;if(!n)return;const i=(_,L,C,S)=>{const b=document.createElement("button");return b.type="button",b.className=`button buttons-secondary button-small ${_} iw-attachment-action`,b.textContent=L,b.addEventListener("click",()=>{c.actionLocation="media-modal",c.action=C,c.runAttachmentAction(C,e,S)}),b},a=d.apply_label||"Apply watermark",s=d.remove_label||"Remove watermark",l=d.setting_label||"Watermark",r=document.createElement("span");r.className="setting iw-watermark-setting",r.setAttribute("data-setting","iw-watermark");const o=document.createElement("label");o.className="name",o.textContent=l;const m=document.createElement("span");m.className="value iw-attachment-actions";const u=document.createElement("p");u.className="iw-attachment-status",u.setAttribute("aria-live","polite");const f=i("iw-attachment-apply",a,"applywatermark",u);if(m.appendChild(f),d.backup_image){const _=i("iw-attachment-remove",s,"removewatermark",u);m.appendChild(_)}m.appendChild(u),r.appendChild(o),r.appendChild(m),n.insertBefore(r,t.nextSibling)},collectSelectionIds(){const t=[],e=this.gridFrame;if(e&&typeof e.state=="function"){const n=e.state().get("selection");n&&n.models&&n.models.forEach(i=>{if(c.isSupportedModel(i)){const a=typeof i.get=="function"?i.get("id"):i.id;a&&t.push(a)}})}return t.length||p(".attachments-browser .attachments .attachment.selected").forEach(n=>{if(c.isSupportedDom(n)){const i=n.getAttribute("data-id");i&&t.push(i)}}),t},startGridAction(t){const e=this.collectSelectionIds();if(!e.length){this.notice("iw-notice error",d.__running,!1);return}!d.backup_image&&t==="removewatermark"||this.isGridSelectModeActive()&&(this.running=!0,this.action=t,this.actionLocation="grid",this.selected=e.slice(0),y(),this.updateGridButtonsState(),this.postLoop())},postLoop(){if(!this.selected.length){this.reset();return}const t=this.selected[0],e=Number(t);if(Number.isNaN(e)){this.selected.shift(),this.postLoop();return}this.rowImageFeedback(e),this.actionLocation==="upload-list"&&this.scrollTo(`#post-${e}`,"bottom");const n=v({_iw_nonce:d._nonce,action:"iw_watermark_bulk_action","iw-action":this.action,attachment_id:e});A(window.ajaxurl||"/wp-admin/admin-ajax.php",n).then(i=>{this.result(i,e)},i=>{this.notice("iw-notice error",i&&i.message||"Request failed",!1),this.rowImageFeedback(e)}).then(()=>{this.selected.shift(),this.postLoop();const i=h(".iw-overlay");if(i){const a=h("#image_watermark_buttons .value");if(a&&(this.response==="watermarked"||this.response==="watermarkremoved")){const s=document.createElement("span");s.className="dashicons dashicons-yes",s.style.cssText="font-size:24px;float:none;min-width:28px;padding:0;margin:0;display:none;",a.appendChild(s),s.style.display="",setTimeout(()=>{s.remove()},1500)}i.remove()}})},result(t,e){if(!t){this.notice("iw-notice error",d.__running,!1),this.rowImageFeedback(e);return}const n=t.data,i=t.success===!0;let a=!1,s="",l=!0;this.response=n,i&&n==="watermarked"?(a="iw-notice updated iw-watermarked",this.successCount+=1,s=this.successCount>1?d.__applied_multi.replace("%s",this.successCount):d.__applied_one,this.rowImageFeedback(e),this.reloadImage(e),this.refreshAttachmentCache(e)):i&&n==="watermarkremoved"?(a="iw-notice updated iw-watermarkremoved",this.successCount+=1,s=this.successCount>1?d.__removed_multi.replace("%s",this.successCount):d.__removed_one,this.rowImageFeedback(e),this.reloadImage(e),this.refreshAttachmentCache(e)):n==="skipped"?(a="iw-notice error iw-skipped",this.skippedCount+=1,s=`${d.__skipped}: ${this.skippedCount}`,this.rowImageFeedback(e)):(a="iw-notice error iw-message",s=n||d.__running,this.rowImageFeedback(e),l=!1),a&&this.notice(a,s,l)},rowImageFeedback(t){let e="",n={},i={};switch(this.actionLocation){case"upload-list":{e=`.wp-list-table #post-${t} .media-icon`;const r=h(e),o=r?r.getBoundingClientRect():{width:0,height:0};n={display:"table",width:`${o.width||0}px`,height:`${o.height||0}px`,top:"0",left:"0",position:"absolute",font:"normal normal normal dashicons",background:"rgba(255,255,255,0.75)",content:""},i={verticalAlign:"middle",textAlign:"center",display:"table-cell",width:"100%",height:"100%"};break}case"grid":{e=`.attachments-browser .attachments [data-id="${t}"] .attachment-preview`;const r=h(e),o=r?r.getBoundingClientRect():{width:0,height:0};n={display:"table",width:`${o.width||0}px`,height:`${o.height||0}px`,top:"0",left:"0",position:"absolute",font:"normal normal normal dashicons",background:"rgba(255,255,255,0.75)",content:""},i={verticalAlign:"middle",textAlign:"center",display:"table-cell",width:"100%",height:"100%"};break}case"edit":{e=`.wp_attachment_holder #thumbnail-head-${t}`;const r=h(`${e} img`),o=r?r.getBoundingClientRect():{width:0,height:0};n={display:"table",width:`${o.width||0}px`,height:`${o.height||0}px`,top:"0",left:"0",position:"absolute",font:"normal normal normal dashicons",background:"rgba(255,255,255,0.75)",content:""},i={verticalAlign:"middle",textAlign:"center",display:"table-cell",width:"100%",height:"100%"};break}default:return}const a=h(e);if(!a)return;getComputedStyle(a).position==="static"&&(a.style.position="relative");let s=a.querySelector(".iw-overlay");if(!s){s=document.createElement("span"),s.className="iw-overlay";const r=document.createElement("span");r.className="iw-overlay-inner",s.appendChild(r),a.appendChild(s)}for(const r in n)Object.prototype.hasOwnProperty.call(n,r)&&(s.style[r]=n[r]);const l=s.querySelector(".iw-overlay-inner");for(const r in i)Object.prototype.hasOwnProperty.call(i,r)&&(l.style[r]=i[r]);if(l.innerHTML='<span class="spinner is-active"></span>',this.actionLocation==="media-modal"){const r=l.querySelector(".spinner");r&&(r.style.cssText="float:none;padding:0;margin:-4px 0 0 10px;")}},notice(t,e,n){if(this.actionLocation==="media-modal")return;const i=`${t} notice is-dismissible`;let a=this.actionLocation==="upload-list"?".wrap > h1":"#image_watermark_buttons",s=null;if(n===!0){switch(this.response){case"watermarked":s=".iw-notice.iw-watermarked";break;case"watermarkremoved":s=".iw-notice.iw-watermarkremoved";break;case"skipped":s=".iw-notice.iw-skipped";break}if(s){const o=a.charAt(a.length-1)===" "?a:`${a} `,m=h(o+s+" > p");if(m){m.innerHTML=e;return}a=this.actionLocation==="upload-list"?".wrap ":"#image_watermark_buttons "}}const l=h(a);if(!l||!l.parentElement)return;const r=document.createElement("div");r.className=i,r.innerHTML=`<p>${e}</p><button type="button" class="notice-dismiss"><span class="screen-reader-text">${d.__dismiss}</span></button>`,l.insertAdjacentElement("afterend",r)},reset(){this.running=!1,this.action="",this.response="",this.selected=[],this.successCount=0,this.skippedCount=0,setTimeout(I,100),this.updateGridButtonsState()},reloadImage(t){const e=Date.now(),n=[];switch(this.actionLocation){case"upload-list":n.push(`.wp-list-table #post-${t} .image-icon img`);break;case"grid":n.push(`.attachments-browser .attachments [data-id="${t}"] img`),n.push('.attachment-details[data-id="'+t+'"] img, .attachment[data-id="'+t+'"] img, .attachment-info .thumbnail img, .attachment-media-view img');break;case"media-modal":n.push('.attachment-details[data-id="'+t+'"] img, .attachment[data-id="'+t+'"] img, .attachment-info .thumbnail img, .attachment-media-view img');break;case"edit":n.push(".attachment-info .thumbnail img, .attachment-media-view img, .wp_attachment_holder img");break}const i=n.filter(Boolean);i.length&&p(i.join(",")).forEach(a=>{a.removeAttribute("srcset"),a.removeAttribute("sizes");const s=a.getAttribute("src")||"";a.setAttribute("src",this.replaceUrlParam(s,"t",e))})},isSupportedModel(t){if(!t)return!1;const e=typeof t.get=="function"?t.get("type"):t.type,n=(typeof t.get=="function"?t.get("mime"):t.mime)||(e&&typeof t.get=="function"&&t.get("subtype")?`${e}/${t.get("subtype")}`:"");return e!=="image"&&(!n||n.indexOf("image/")!==0)?!1:k?k.indexOf(n)!==-1:!0},isSupportedDom(t){if(!t)return!1;const e=t.getAttribute("data-type")||"",n=t.getAttribute("data-subtype")||"",i=e&&n?`${e}/${n}`:"";return e!=="image"&&(!i||i.indexOf("image/")!==0)?!1:k?k.indexOf(i)!==-1:!0},refreshAttachmentCache(t){if(typeof wp=="undefined"||!wp.media||!wp.media.attachment)return;const e=wp.media.attachment(t);e&&e.fetch({cache:!1}).then(()=>{c.cacheBustAttachmentSources(e)})},cacheBustAttachmentSources(t){if(!t||typeof t.get!="function")return;const e=Date.now(),n={};if(t.get("url")&&(n.url=this.replaceUrlParam(t.get("url"),"t",e)),t.get("sizes")){const i=t.get("sizes"),a={};Object.keys(i).forEach(s=>{const l=i[s];if(l&&l.url){const r={};Object.keys(l).forEach(o=>{r[o]=l[o]}),r.url=this.replaceUrlParam(l.url,"t",e),a[s]=r}else a[s]=l}),n.sizes=a}t.get("icon")&&(n.icon=this.replaceUrlParam(t.get("icon"),"t",e)),Object.keys(n).length&&t.set(n)},replaceUrlParam(t,e,n){const i=new RegExp(`\\b(${e}=).*?(&|$)`);return i.test(t)?t.replace(i,`$1${n}$2`):`${t}${t.indexOf("?")>0?"&":"?"}${e}=${n}`},scrollTo(t,e){const n=h(t);if(!n)return;const i=n.getBoundingClientRect(),a=i.top+window.pageYOffset,s=window.pageYOffset,l=s+window.innerHeight;let r=a;if(i.top+window.pageYOffset<s)r=a;else if(e==="bottom"){if(i.top+window.pageYOffset<l)return;r=a-window.innerHeight+i.height}else if(e==="center"){if(a<l&&a>=s)return;r=a-window.innerHeight/2+i.height/2}window.scrollTo(0,r)},refreshAttachmentThumb(t){const e=[".attachment-info .thumbnail img",".attachment-media-view img",'.attachment-details[data-id="'+t+'"] img','.attachment[data-id="'+t+'"] img'],n=Date.now();p(e.join(",")).forEach(i=>{const a=i.getAttribute("src")||"";i.removeAttribute("srcset"),i.removeAttribute("sizes"),i.setAttribute("src",c.replaceUrlParam(a,"t",n))})}};window.watermarkImageActions=c,typeof window!="undefined"&&(window.iw=window.iw||{},window.iw.imageActions=Object.assign(window.iw.imageActions||{},{qs:h,qsa:p,matches:B,closest:g,isVisible:w,clearNotices:y,removeOverlays:I,encodeForm:v,requestJson:A,api:c})),typeof d._nonce!="undefined"&&document.addEventListener("DOMContentLoaded",()=>c.init())})();1 (function(){"use strict";(()=>{const d=window.iwArgsImageActions||{},k=Array.isArray(d.allowed_mimes)&&d.allowed_mimes.length?d.allowed_mimes:null,h=(t,e=document)=>(e||document).querySelector(t),p=(t,e=document)=>Array.prototype.slice.call((e||document).querySelectorAll(t)),B=(t,e)=>{if(!t)return!1;const n=t.matches||t.msMatchesSelector||t.webkitMatchesSelector;return n?n.call(t,e):!1},g=(t,e)=>{let n=t;for(;n;){if(B(n,e))return n;n=n.parentElement}return null},w=t=>!!(t&&(t.offsetWidth||t.offsetHeight||t.getClientRects().length)),y=()=>p(".iw-notice").forEach(t=>t.remove()),I=()=>p(".iw-overlay").forEach(t=>t.remove()),v=t=>Object.keys(t).map(e=>`${encodeURIComponent(e)}=${encodeURIComponent(t[e])}`).join("&"),A=(t,e)=>new Promise((n,i)=>{if(window.fetch){window.fetch(t,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},body:e}).then(s=>s.json()).then(n).catch(i);return}const a=new XMLHttpRequest;a.open("POST",t,!0),a.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),a.onreadystatechange=function(){if(a.readyState===4)if(a.status>=200&&a.status<300)try{n(JSON.parse(a.responseText))}catch(c){i(c)}else i(new Error("Request failed"))},a.send(e)}),l={running:!1,actionLocation:"",action:"",response:"",selected:[],successCount:0,skippedCount:0,gridButtonsBound:!1,gridFrame:null,gridButtons:[],gridDomInterval:null,attachmentInfoToken:0,getFrameState(t=null){const e=t||this.gridFrame;if(!e||typeof e.state!="function")return null;try{const n=e.state();return n&&typeof n.get=="function"?n:null}catch(n){return null}},getFrameSelection(t=null){const e=this.getFrameState(t);return e?e.get("selection"):null},isGridSelectModeActive(){const t=h(".select-mode-toggle-button");if(t&&((t.getAttribute("aria-pressed")||t.getAttribute("aria-checked"))==="true"||t.classList&&(t.classList.contains("active")||t.classList.contains("is-pressed"))))return!0;const e=h(".attachments-browser");if(e&&(e.classList.contains("mode-select")||e.classList.contains("is-attachment-select-mode")||e.classList.contains("select-mode")))return!0;const n=h(".media-frame");return!!(n&&(n.classList.contains("mode-select")||n.classList.contains("select-mode"))||p(".attachments-browser .attachments .attachment.selected").length)},init(){document.addEventListener("click",t=>{const e=g(t.target,".bulkactions input#doaction, .bulkactions input#doaction2");if(!e)return;const n=g(e,".bulkactions"),i=n?n.querySelector("select"):null,a=i?i.value:"";if(!(!a||!d.backup_image&&a==="removewatermark")&&(a==="applywatermark"||a==="removewatermark")){if(t.preventDefault(),l.running){l.notice("iw-notice error",d.__running,!1);return}l.running=!0,l.action=a,l.actionLocation="upload-list",l.selected=p('.wp-list-table .check-column input[type="checkbox"]:checked').map(s=>s.value),y(),l.postLoop()}}),document.addEventListener("click",t=>{const e=g(t.target,".iw-notice.is-dismissible .notice-dismiss");if(e){const n=g(e,".iw-notice");n&&n.remove()}}),this.initGridMode()},initGridMode(){if(this.gridButtonsBound||typeof wp=="undefined"||!wp.media||typeof window.iwArgsMedia=="undefined")return;const t=i=>{this.gridButtonsBound=!0,this.gridFrame=i,i.on("ready",this.renderGridButtons),i.on("select:activate",this.renderGridButtons),i.on("select:deactivate",this.hideGridButtons),i.on("selection:toggle selection:action:done library:selection:add",this.updateGridButtonsState),i.on("attachments:selected",this.updateAttachmentInfoActions),i.on("selection:change",this.updateAttachmentInfoActions),i.on("toolbar:render:details",this.updateAttachmentInfoActions),i.on("content:render",this.updateAttachmentInfoActions),this.renderGridButtons(),this.updateAttachmentInfoActions()},e=()=>{const i=wp.media&&(wp.media.frame||wp.media.frames&&(wp.media.frames.browse||wp.media.frames.manage));return i&&typeof i.on=="function"?(t(i),!0):!1};if(!e()){const i=setInterval(()=>{e()&&clearInterval(i)},300)}new MutationObserver(i=>{i.forEach(a=>{a.addedNodes.forEach(s=>{s.nodeType===Node.ELEMENT_NODE&&(s.matches(".attachment-info")||s.querySelector(".attachment-info"))&&l.updateAttachmentInfoActions()})})}).observe(document.body,{childList:!0,subtree:!0}),document.addEventListener("click",i=>{g(i.target,".select-mode-toggle-button")&&(this.renderGridButtons(),this.gridDomInterval&&clearInterval(this.gridDomInterval),this.gridDomInterval=setInterval(()=>{this.renderGridButtons()},400),setTimeout(()=>{this.gridDomInterval&&(clearInterval(this.gridDomInterval),this.gridDomInterval=null)},3e3))}),document.addEventListener("click",i=>{g(i.target,".attachments-browser .attachment, .attachments-browser .attachment .check")&&setTimeout(this.updateGridButtonsState,50)})},ensureGridButtonsDom(){if(h(".media-modal"))return!1;const e=(()=>{const o=[".media-frame.mode-grid .media-frame-toolbar .media-toolbar",".media-frame.mode-grid .media-toolbar",".media-frame .media-frame-toolbar .media-toolbar",".attachments-browser .media-toolbar",".attachments-browser .attachments-filters"];for(let m=0;m<o.length;m++){const u=p(o[m]);for(let f=0;f<u.length;f++)if(w(u[f]))return u[f]}return null})();if(!e)return!1;const n=(()=>{const o=p(".media-toolbar-primary",e);for(let u=0;u<o.length;u++)if(w(o[u]))return o[u];const m=p(".media-toolbar-secondary",e);for(let u=0;u<m.length;u++)if(w(m[u]))return m[u];return e})();if(!n)return!1;n.style.overflow="visible",p(".iw-grid-watermark-apply, .iw-grid-watermark-remove",n).forEach(o=>o.remove());const i=(o,m,u)=>{const f=document.createElement("button");return f.type="button",f.className=`button media-button ${o}`,f.textContent=m,f.addEventListener("click",()=>this.startGridAction(u)),f},a=(()=>{const o=p(".select-mode-toggle-button",n);for(let m=0;m<o.length;m++)if(w(o[m]))return o[m];return null})(),s=i("iw-grid-watermark-apply",window.iwArgsMedia.applyWatermark,"applywatermark"),c=a||n.firstChild||null;n.insertBefore(s,c);const r=[s];if(d.backup_image){const o=i("iw-grid-watermark-remove",window.iwArgsMedia.removeWatermark,"removewatermark");n.insertBefore(o,c),r.push(o)}return this.gridButtons=r,this.hideGridButtons(),!0},renderGridButtons:()=>{if(l.ensureGridButtonsDom()){if(!l.isGridSelectModeActive()){l.hideGridButtons();return}l.gridButtons.forEach(t=>{t.style.display=""}),l.updateGridButtonsState()}},hideGridButtons:()=>{l.gridButtons.forEach(t=>{t.disabled=!0,t.style.display="none"})},updateGridButtonsState:()=>{if(!l.gridButtons.length)return;if(!l.isGridSelectModeActive()){l.hideGridButtons();return}const t=l.collectSelectionIds(),e=l.running||t.length===0;l.gridButtons.forEach(n=>{n&&(n.disabled=e||n.classList.contains("iw-grid-watermark-remove")&&!d.backup_image)})},runAttachmentAction:(t,e,n)=>{if(l.running)return;const i=p(".iw-attachment-action");i.forEach(c=>c.classList.add("disabled")),n&&(n.textContent=d.single_running,n.className="iw-attachment-status");const a=v({_iw_nonce:d._nonce,action:"iw_watermark_bulk_action","iw-action":t,attachment_id:e}),s=()=>{i.forEach(c=>c.classList.remove("disabled")),l.running=!1};l.running=!0,A(window.ajaxurl||"/wp-admin/admin-ajax.php",a).then(c=>{if(c&&c.success===!0&&(c.data==="watermarked"||c.data==="watermarkremoved")){const m=t==="applywatermark"?d.single_applied:d.single_removed;n&&(n.textContent=m,n.className="iw-attachment-status success"),l.refreshAttachmentThumb(e);return}let o=d.single_error;c&&typeof c.data=="string"&&(o=c.data==="skipped"?d.single_skipped||d.__skipped||o:c.data),n&&(n.textContent=o,n.className="iw-attachment-status error")}).then(s)},updateAttachmentInfoActions:()=>{p(".media-modal .iw-attachment-action, .media-modal .iw-separator, .media-modal .iw-watermark-setting").forEach(r=>r.remove()),l.attachmentInfoToken+=1;const t=l.attachmentInfoToken,e=h(".media-modal #image_watermark_buttons"),n=l.getFrameSelection(),i=n&&n.first?n.first():null,a=()=>i&&typeof i.get=="function"?i.get("id"):e?e.getAttribute("data-id"):null,s=()=>i?l.isSupportedModel(i):!0,c=(r=0)=>{if(t!==l.attachmentInfoToken)return;const o=h('.media-modal .attachment-details .setting[data-setting="url"]')||h('.media-modal .attachment-info .setting[data-setting="url"]'),m=a();if(!m||!s()||o&&g(o,".iw-is-watermark-selector"))return;if(!o){r<20&&setTimeout(()=>c(r+1),100);return}o.parentElement&&o.parentElement.querySelector(".iw-watermark-setting")||l.injectAttachmentActions(o,m)};c()},injectAttachmentActions:(t,e)=>{if(!e||!t)return;const n=t.parentElement;if(!n)return;const i=(_,C,S,L)=>{const b=document.createElement("button");return b.type="button",b.className=`button buttons-secondary button-small ${_} iw-attachment-action`,b.textContent=C,b.addEventListener("click",()=>{l.actionLocation="media-modal",l.action=S,l.runAttachmentAction(S,e,L)}),b},a=d.apply_label||"Apply watermark",s=d.remove_label||"Remove watermark",c=d.setting_label||"Watermark",r=document.createElement("span");r.className="setting iw-watermark-setting",r.setAttribute("data-setting","iw-watermark");const o=document.createElement("label");o.className="name",o.textContent=c;const m=document.createElement("span");m.className="value iw-attachment-actions";const u=document.createElement("p");u.className="iw-attachment-status",u.setAttribute("aria-live","polite");const f=i("iw-attachment-apply",a,"applywatermark",u);if(m.appendChild(f),d.backup_image){const _=i("iw-attachment-remove",s,"removewatermark",u);m.appendChild(_)}m.appendChild(u),r.appendChild(o),r.appendChild(m),n.insertBefore(r,t.nextSibling)},collectSelectionIds(){const t=[],e=this.gridFrame;if(e){const n=this.getFrameSelection(e);n&&n.models&&n.models.forEach(i=>{if(l.isSupportedModel(i)){const a=typeof i.get=="function"?i.get("id"):i.id;a&&t.push(a)}})}return t.length||p(".attachments-browser .attachments .attachment.selected").forEach(n=>{if(l.isSupportedDom(n)){const i=n.getAttribute("data-id");i&&t.push(i)}}),t},startGridAction(t){const e=this.collectSelectionIds();if(!e.length){this.notice("iw-notice error",d.__running,!1);return}!d.backup_image&&t==="removewatermark"||this.isGridSelectModeActive()&&(this.running=!0,this.action=t,this.actionLocation="grid",this.selected=e.slice(0),y(),this.updateGridButtonsState(),this.postLoop())},postLoop(){if(!this.selected.length){this.reset();return}const t=this.selected[0],e=Number(t);if(Number.isNaN(e)){this.selected.shift(),this.postLoop();return}this.rowImageFeedback(e),this.actionLocation==="upload-list"&&this.scrollTo(`#post-${e}`,"bottom");const n=v({_iw_nonce:d._nonce,action:"iw_watermark_bulk_action","iw-action":this.action,attachment_id:e});A(window.ajaxurl||"/wp-admin/admin-ajax.php",n).then(i=>{this.result(i,e)},i=>{this.notice("iw-notice error",i&&i.message||"Request failed",!1),this.rowImageFeedback(e)}).then(()=>{this.selected.shift(),this.postLoop();const i=h(".iw-overlay");if(i){const a=h("#image_watermark_buttons .value");if(a&&(this.response==="watermarked"||this.response==="watermarkremoved")){const s=document.createElement("span");s.className="dashicons dashicons-yes",s.style.cssText="font-size:24px;float:none;min-width:28px;padding:0;margin:0;display:none;",a.appendChild(s),s.style.display="",setTimeout(()=>{s.remove()},1500)}i.remove()}})},result(t,e){if(!t){this.notice("iw-notice error",d.__running,!1),this.rowImageFeedback(e);return}const n=t.data,i=t.success===!0;let a,s,c=!0;this.response=n,i&&n==="watermarked"?(a="iw-notice updated iw-watermarked",this.successCount+=1,s=this.successCount>1?d.__applied_multi.replace("%s",this.successCount):d.__applied_one,this.rowImageFeedback(e),this.reloadImage(e),this.refreshAttachmentCache(e)):i&&n==="watermarkremoved"?(a="iw-notice updated iw-watermarkremoved",this.successCount+=1,s=this.successCount>1?d.__removed_multi.replace("%s",this.successCount):d.__removed_one,this.rowImageFeedback(e),this.reloadImage(e),this.refreshAttachmentCache(e)):n==="skipped"?(a="iw-notice error iw-skipped",this.skippedCount+=1,s=`${d.__skipped}: ${this.skippedCount}`,this.rowImageFeedback(e)):(a="iw-notice error iw-message",s=n||d.__running,this.rowImageFeedback(e),c=!1),a&&this.notice(a,s,c)},rowImageFeedback(t){let e,n,i;switch(this.actionLocation){case"upload-list":{e=`.wp-list-table #post-${t} .media-icon`;const r=h(e),o=r?r.getBoundingClientRect():{width:0,height:0};n={display:"table",width:`${o.width||0}px`,height:`${o.height||0}px`,top:"0",left:"0",position:"absolute",font:"normal normal normal dashicons",background:"rgba(255,255,255,0.75)",content:""},i={verticalAlign:"middle",textAlign:"center",display:"table-cell",width:"100%",height:"100%"};break}case"grid":{e=`.attachments-browser .attachments [data-id="${t}"] .attachment-preview`;const r=h(e),o=r?r.getBoundingClientRect():{width:0,height:0};n={display:"table",width:`${o.width||0}px`,height:`${o.height||0}px`,top:"0",left:"0",position:"absolute",font:"normal normal normal dashicons",background:"rgba(255,255,255,0.75)",content:""},i={verticalAlign:"middle",textAlign:"center",display:"table-cell",width:"100%",height:"100%"};break}case"edit":{e=`.wp_attachment_holder #thumbnail-head-${t}`;const r=h(`${e} img`),o=r?r.getBoundingClientRect():{width:0,height:0};n={display:"table",width:`${o.width||0}px`,height:`${o.height||0}px`,top:"0",left:"0",position:"absolute",font:"normal normal normal dashicons",background:"rgba(255,255,255,0.75)",content:""},i={verticalAlign:"middle",textAlign:"center",display:"table-cell",width:"100%",height:"100%"};break}default:return}const a=h(e);if(!a)return;getComputedStyle(a).position==="static"&&(a.style.position="relative");let s=a.querySelector(".iw-overlay");if(!s){s=document.createElement("span"),s.className="iw-overlay";const r=document.createElement("span");r.className="iw-overlay-inner",s.appendChild(r),a.appendChild(s)}for(const r in n)Object.prototype.hasOwnProperty.call(n,r)&&(s.style[r]=n[r]);const c=s.querySelector(".iw-overlay-inner");for(const r in i)Object.prototype.hasOwnProperty.call(i,r)&&(c.style[r]=i[r]);if(c.innerHTML='<span class="spinner is-active"></span>',this.actionLocation==="media-modal"){const r=c.querySelector(".spinner");r&&(r.style.cssText="float:none;padding:0;margin:-4px 0 0 10px;")}},notice(t,e,n){if(this.actionLocation==="media-modal")return;const i=`${t} notice is-dismissible`;let a=this.actionLocation==="upload-list"?".wrap > h1":"#image_watermark_buttons",s=null;if(n===!0){switch(this.response){case"watermarked":s=".iw-notice.iw-watermarked";break;case"watermarkremoved":s=".iw-notice.iw-watermarkremoved";break;case"skipped":s=".iw-notice.iw-skipped";break}if(s){const o=a.charAt(a.length-1)===" "?a:`${a} `,m=h(o+s+" > p");if(m){m.innerHTML=e;return}a=this.actionLocation==="upload-list"?".wrap ":"#image_watermark_buttons "}}const c=h(a);if(!c||!c.parentElement)return;const r=document.createElement("div");r.className=i,r.innerHTML=`<p>${e}</p><button type="button" class="notice-dismiss"><span class="screen-reader-text">${d.__dismiss}</span></button>`,c.insertAdjacentElement("afterend",r)},reset(){this.running=!1,this.action="",this.response="",this.selected=[],this.successCount=0,this.skippedCount=0,setTimeout(I,100),this.updateGridButtonsState()},reloadImage(t){const e=Date.now(),n=[];switch(this.actionLocation){case"upload-list":n.push(`.wp-list-table #post-${t} .image-icon img`);break;case"grid":n.push(`.attachments-browser .attachments [data-id="${t}"] img`),n.push('.attachment-details[data-id="'+t+'"] img, .attachment[data-id="'+t+'"] img, .attachment-info .thumbnail img, .attachment-media-view img');break;case"media-modal":n.push('.attachment-details[data-id="'+t+'"] img, .attachment[data-id="'+t+'"] img, .attachment-info .thumbnail img, .attachment-media-view img');break;case"edit":n.push(".attachment-info .thumbnail img, .attachment-media-view img, .wp_attachment_holder img");break}const i=n.filter(Boolean);i.length&&p(i.join(",")).forEach(a=>{a.removeAttribute("srcset"),a.removeAttribute("sizes");const s=a.getAttribute("src")||"";a.setAttribute("src",this.replaceUrlParam(s,"t",e))})},isSupportedModel(t){if(!t)return!1;const e=typeof t.get=="function"?t.get("type"):t.type,n=(typeof t.get=="function"?t.get("mime"):t.mime)||(e&&typeof t.get=="function"&&t.get("subtype")?`${e}/${t.get("subtype")}`:"");return e!=="image"&&(!n||n.indexOf("image/")!==0)?!1:k?k.indexOf(n)!==-1:!0},isSupportedDom(t){if(!t)return!1;const e=t.getAttribute("data-type")||"",n=t.getAttribute("data-subtype")||"",i=e&&n?`${e}/${n}`:"";return e!=="image"&&(!i||i.indexOf("image/")!==0)?!1:k?k.indexOf(i)!==-1:!0},refreshAttachmentCache(t){if(typeof wp=="undefined"||!wp.media||!wp.media.attachment)return;const e=wp.media.attachment(t);e&&e.fetch({cache:!1}).then(()=>{l.cacheBustAttachmentSources(e)})},cacheBustAttachmentSources(t){if(!t||typeof t.get!="function")return;const e=Date.now(),n={};if(t.get("url")&&(n.url=this.replaceUrlParam(t.get("url"),"t",e)),t.get("sizes")){const i=t.get("sizes"),a={};Object.keys(i).forEach(s=>{const c=i[s];if(c&&c.url){const r={};Object.keys(c).forEach(o=>{r[o]=c[o]}),r.url=this.replaceUrlParam(c.url,"t",e),a[s]=r}else a[s]=c}),n.sizes=a}t.get("icon")&&(n.icon=this.replaceUrlParam(t.get("icon"),"t",e)),Object.keys(n).length&&t.set(n)},replaceUrlParam(t,e,n){const i=new RegExp(`\\b(${e}=).*?(&|$)`);return i.test(t)?t.replace(i,`$1${n}$2`):`${t}${t.indexOf("?")>0?"&":"?"}${e}=${n}`},scrollTo(t,e){const n=h(t);if(!n)return;const i=n.getBoundingClientRect(),a=i.top+window.pageYOffset,s=window.pageYOffset,c=s+window.innerHeight;let r=a;if(i.top+window.pageYOffset<s)r=a;else if(e==="bottom"){if(i.top+window.pageYOffset<c)return;r=a-window.innerHeight+i.height}else if(e==="center"){if(a<c&&a>=s)return;r=a-window.innerHeight/2+i.height/2}window.scrollTo(0,r)},refreshAttachmentThumb(t){const e=[".attachment-info .thumbnail img",".attachment-media-view img",'.attachment-details[data-id="'+t+'"] img','.attachment[data-id="'+t+'"] img'],n=Date.now();p(e.join(",")).forEach(i=>{const a=i.getAttribute("src")||"";i.removeAttribute("srcset"),i.removeAttribute("sizes"),i.setAttribute("src",l.replaceUrlParam(a,"t",n))})}};window.watermarkImageActions=l,typeof window!="undefined"&&(window.iw=window.iw||{},window.iw.imageActions=Object.assign(window.iw.imageActions||{},{qs:h,qsa:p,matches:B,closest:g,isVisible:w,clearNotices:y,removeOverlays:I,encodeForm:v,requestJson:A,api:l})),typeof d._nonce!="undefined"&&document.addEventListener("DOMContentLoaded",()=>l.init())})(); 2 2 })(); -
image-watermark/tags/2.0.9/readme.txt
r3458905 r3478278 6 6 Requires PHP: 7.0 7 7 Tested up to: 6.9.1 8 Stable tag: 2.0. 88 Stable tag: 2.0.9 9 9 License: MIT License 10 10 License URI: http://opensource.org/licenses/MIT … … 98 98 == Changelog == 99 99 100 = 2.0.9 = 101 * Fix: Gutenberg auto-watermarking for admin media uploads 102 * Fix: Admin media frame state guard on post editor screens 103 * Tweak: Add WordPress PHPUnit coverage and unified test command 104 100 105 = 2.0.8 = 101 106 * New: Optional preservation of file timestamps for backup and restore … … 309 314 == Upgrade Notice == 310 315 311 = 2.0. 8=312 Adds optional preservation of file timestamps during backup and restore operations.316 = 2.0.9 = 317 Fixes Gutenberg auto-watermarking and admin media frame compatibility issues.
Note: See TracChangeset
for help on using the changeset viewer.