Edit File by line
/home/barbar84/www/wp-admin/js
File: common.js
top = parseInt( $submenu.css( 'top' ), 10 );
[1000] Fix | Delete
[1001] Fix | Delete
if ( isNaN( top ) || top > -5 ) { // The submenu is visible.
[1002] Fix | Delete
return;
[1003] Fix | Delete
}
[1004] Fix | Delete
[1005] Fix | Delete
if ( $adminmenu.data( 'wp-responsive' ) ) {
[1006] Fix | Delete
// The menu is in responsive mode, bail.
[1007] Fix | Delete
return;
[1008] Fix | Delete
}
[1009] Fix | Delete
[1010] Fix | Delete
adjustSubmenu( $menuItem );
[1011] Fix | Delete
$adminmenu.find( 'li.opensub' ).removeClass( 'opensub' );
[1012] Fix | Delete
$menuItem.addClass( 'opensub' );
[1013] Fix | Delete
},
[1014] Fix | Delete
[1015] Fix | Delete
/**
[1016] Fix | Delete
* Closes the submenu when no longer hovering the menu item.
[1017] Fix | Delete
*
[1018] Fix | Delete
* @return {void}
[1019] Fix | Delete
*/
[1020] Fix | Delete
out: function(){
[1021] Fix | Delete
if ( $adminmenu.data( 'wp-responsive' ) ) {
[1022] Fix | Delete
// The menu is in responsive mode, bail.
[1023] Fix | Delete
return;
[1024] Fix | Delete
}
[1025] Fix | Delete
[1026] Fix | Delete
$( this ).removeClass( 'opensub' ).find( '.wp-submenu' ).css( 'margin-top', '' );
[1027] Fix | Delete
},
[1028] Fix | Delete
timeout: 200,
[1029] Fix | Delete
sensitivity: 7,
[1030] Fix | Delete
interval: 90
[1031] Fix | Delete
});
[1032] Fix | Delete
[1033] Fix | Delete
/**
[1034] Fix | Delete
* Opens the submenu on when focused on the menu item.
[1035] Fix | Delete
*
[1036] Fix | Delete
* @param {Event} event The event object.
[1037] Fix | Delete
*
[1038] Fix | Delete
* @return {void}
[1039] Fix | Delete
*/
[1040] Fix | Delete
$adminmenu.on( 'focus.adminmenu', '.wp-submenu a', function( event ) {
[1041] Fix | Delete
if ( $adminmenu.data( 'wp-responsive' ) ) {
[1042] Fix | Delete
// The menu is in responsive mode, bail.
[1043] Fix | Delete
return;
[1044] Fix | Delete
}
[1045] Fix | Delete
[1046] Fix | Delete
$( event.target ).closest( 'li.menu-top' ).addClass( 'opensub' );
[1047] Fix | Delete
[1048] Fix | Delete
/**
[1049] Fix | Delete
* Closes the submenu on blur from the menu item.
[1050] Fix | Delete
*
[1051] Fix | Delete
* @param {Event} event The event object.
[1052] Fix | Delete
*
[1053] Fix | Delete
* @return {void}
[1054] Fix | Delete
*/
[1055] Fix | Delete
}).on( 'blur.adminmenu', '.wp-submenu a', function( event ) {
[1056] Fix | Delete
if ( $adminmenu.data( 'wp-responsive' ) ) {
[1057] Fix | Delete
return;
[1058] Fix | Delete
}
[1059] Fix | Delete
[1060] Fix | Delete
$( event.target ).closest( 'li.menu-top' ).removeClass( 'opensub' );
[1061] Fix | Delete
[1062] Fix | Delete
/**
[1063] Fix | Delete
* Adjusts the size for the submenu.
[1064] Fix | Delete
*
[1065] Fix | Delete
* @return {void}
[1066] Fix | Delete
*/
[1067] Fix | Delete
}).find( 'li.wp-has-submenu.wp-not-current-submenu' ).on( 'focusin.adminmenu', function() {
[1068] Fix | Delete
adjustSubmenu( $( this ) );
[1069] Fix | Delete
});
[1070] Fix | Delete
}
[1071] Fix | Delete
[1072] Fix | Delete
/*
[1073] Fix | Delete
* The `.below-h2` class is here just for backward compatibility with plugins
[1074] Fix | Delete
* that are (incorrectly) using it. Do not use. Use `.inline` instead. See #34570.
[1075] Fix | Delete
* If '.wp-header-end' is found, append the notices after it otherwise
[1076] Fix | Delete
* after the first h1 or h2 heading found within the main content.
[1077] Fix | Delete
*/
[1078] Fix | Delete
if ( ! $headerEnd.length ) {
[1079] Fix | Delete
$headerEnd = $( '.wrap h1, .wrap h2' ).first();
[1080] Fix | Delete
}
[1081] Fix | Delete
$( 'div.updated, div.error, div.notice' ).not( '.inline, .below-h2' ).insertAfter( $headerEnd );
[1082] Fix | Delete
[1083] Fix | Delete
/**
[1084] Fix | Delete
* Makes notices dismissible.
[1085] Fix | Delete
*
[1086] Fix | Delete
* @since 4.4.0
[1087] Fix | Delete
*
[1088] Fix | Delete
* @return {void}
[1089] Fix | Delete
*/
[1090] Fix | Delete
function makeNoticesDismissible() {
[1091] Fix | Delete
$( '.notice.is-dismissible' ).each( function() {
[1092] Fix | Delete
var $el = $( this ),
[1093] Fix | Delete
$button = $( '<button type="button" class="notice-dismiss"><span class="screen-reader-text"></span></button>' );
[1094] Fix | Delete
[1095] Fix | Delete
if ( $el.find( '.notice-dismiss' ).length ) {
[1096] Fix | Delete
return;
[1097] Fix | Delete
}
[1098] Fix | Delete
[1099] Fix | Delete
// Ensure plain text.
[1100] Fix | Delete
$button.find( '.screen-reader-text' ).text( __( 'Dismiss this notice.' ) );
[1101] Fix | Delete
$button.on( 'click.wp-dismiss-notice', function( event ) {
[1102] Fix | Delete
event.preventDefault();
[1103] Fix | Delete
$el.fadeTo( 100, 0, function() {
[1104] Fix | Delete
$el.slideUp( 100, function() {
[1105] Fix | Delete
$el.remove();
[1106] Fix | Delete
});
[1107] Fix | Delete
});
[1108] Fix | Delete
});
[1109] Fix | Delete
[1110] Fix | Delete
$el.append( $button );
[1111] Fix | Delete
});
[1112] Fix | Delete
}
[1113] Fix | Delete
[1114] Fix | Delete
$document.on( 'wp-updates-notice-added wp-plugin-install-error wp-plugin-update-error wp-plugin-delete-error wp-theme-install-error wp-theme-delete-error', makeNoticesDismissible );
[1115] Fix | Delete
[1116] Fix | Delete
// Init screen meta.
[1117] Fix | Delete
screenMeta.init();
[1118] Fix | Delete
[1119] Fix | Delete
/**
[1120] Fix | Delete
* Checks a checkbox.
[1121] Fix | Delete
*
[1122] Fix | Delete
* This event needs to be delegated. Ticket #37973.
[1123] Fix | Delete
*
[1124] Fix | Delete
* @return {boolean} Returns whether a checkbox is checked or not.
[1125] Fix | Delete
*/
[1126] Fix | Delete
$body.on( 'click', 'tbody > tr > .check-column :checkbox', function( event ) {
[1127] Fix | Delete
// Shift click to select a range of checkboxes.
[1128] Fix | Delete
if ( 'undefined' == event.shiftKey ) { return true; }
[1129] Fix | Delete
if ( event.shiftKey ) {
[1130] Fix | Delete
if ( !lastClicked ) { return true; }
[1131] Fix | Delete
checks = $( lastClicked ).closest( 'form' ).find( ':checkbox' ).filter( ':visible:enabled' );
[1132] Fix | Delete
first = checks.index( lastClicked );
[1133] Fix | Delete
last = checks.index( this );
[1134] Fix | Delete
checked = $(this).prop('checked');
[1135] Fix | Delete
if ( 0 < first && 0 < last && first != last ) {
[1136] Fix | Delete
sliced = ( last > first ) ? checks.slice( first, last ) : checks.slice( last, first );
[1137] Fix | Delete
sliced.prop( 'checked', function() {
[1138] Fix | Delete
if ( $(this).closest('tr').is(':visible') )
[1139] Fix | Delete
return checked;
[1140] Fix | Delete
[1141] Fix | Delete
return false;
[1142] Fix | Delete
});
[1143] Fix | Delete
}
[1144] Fix | Delete
}
[1145] Fix | Delete
lastClicked = this;
[1146] Fix | Delete
[1147] Fix | Delete
// Toggle the "Select all" checkboxes depending if the other ones are all checked or not.
[1148] Fix | Delete
var unchecked = $(this).closest('tbody').find(':checkbox').filter(':visible:enabled').not(':checked');
[1149] Fix | Delete
[1150] Fix | Delete
/**
[1151] Fix | Delete
* Determines if all checkboxes are checked.
[1152] Fix | Delete
*
[1153] Fix | Delete
* @return {boolean} Returns true if there are no unchecked checkboxes.
[1154] Fix | Delete
*/
[1155] Fix | Delete
$(this).closest('table').children('thead, tfoot').find(':checkbox').prop('checked', function() {
[1156] Fix | Delete
return ( 0 === unchecked.length );
[1157] Fix | Delete
});
[1158] Fix | Delete
[1159] Fix | Delete
return true;
[1160] Fix | Delete
});
[1161] Fix | Delete
[1162] Fix | Delete
/**
[1163] Fix | Delete
* Controls all the toggles on bulk toggle change.
[1164] Fix | Delete
*
[1165] Fix | Delete
* When the bulk checkbox is changed, all the checkboxes in the tables are changed accordingly.
[1166] Fix | Delete
* When the shift-button is pressed while changing the bulk checkbox the checkboxes in the table are inverted.
[1167] Fix | Delete
*
[1168] Fix | Delete
* This event needs to be delegated. Ticket #37973.
[1169] Fix | Delete
*
[1170] Fix | Delete
* @param {Event} event The event object.
[1171] Fix | Delete
*
[1172] Fix | Delete
* @return {boolean}
[1173] Fix | Delete
*/
[1174] Fix | Delete
$body.on( 'click.wp-toggle-checkboxes', 'thead .check-column :checkbox, tfoot .check-column :checkbox', function( event ) {
[1175] Fix | Delete
var $this = $(this),
[1176] Fix | Delete
$table = $this.closest( 'table' ),
[1177] Fix | Delete
controlChecked = $this.prop('checked'),
[1178] Fix | Delete
toggle = event.shiftKey || $this.data('wp-toggle');
[1179] Fix | Delete
[1180] Fix | Delete
$table.children( 'tbody' ).filter(':visible')
[1181] Fix | Delete
.children().children('.check-column').find(':checkbox')
[1182] Fix | Delete
/**
[1183] Fix | Delete
* Updates the checked state on the checkbox in the table.
[1184] Fix | Delete
*
[1185] Fix | Delete
* @return {boolean} True checks the checkbox, False unchecks the checkbox.
[1186] Fix | Delete
*/
[1187] Fix | Delete
.prop('checked', function() {
[1188] Fix | Delete
if ( $(this).is(':hidden,:disabled') ) {
[1189] Fix | Delete
return false;
[1190] Fix | Delete
}
[1191] Fix | Delete
[1192] Fix | Delete
if ( toggle ) {
[1193] Fix | Delete
return ! $(this).prop( 'checked' );
[1194] Fix | Delete
} else if ( controlChecked ) {
[1195] Fix | Delete
return true;
[1196] Fix | Delete
}
[1197] Fix | Delete
[1198] Fix | Delete
return false;
[1199] Fix | Delete
});
[1200] Fix | Delete
[1201] Fix | Delete
$table.children('thead, tfoot').filter(':visible')
[1202] Fix | Delete
.children().children('.check-column').find(':checkbox')
[1203] Fix | Delete
[1204] Fix | Delete
/**
[1205] Fix | Delete
* Syncs the bulk checkboxes on the top and bottom of the table.
[1206] Fix | Delete
*
[1207] Fix | Delete
* @return {boolean} True checks the checkbox, False unchecks the checkbox.
[1208] Fix | Delete
*/
[1209] Fix | Delete
.prop('checked', function() {
[1210] Fix | Delete
if ( toggle ) {
[1211] Fix | Delete
return false;
[1212] Fix | Delete
} else if ( controlChecked ) {
[1213] Fix | Delete
return true;
[1214] Fix | Delete
}
[1215] Fix | Delete
[1216] Fix | Delete
return false;
[1217] Fix | Delete
});
[1218] Fix | Delete
});
[1219] Fix | Delete
[1220] Fix | Delete
/**
[1221] Fix | Delete
* Marries a secondary control to its primary control.
[1222] Fix | Delete
*
[1223] Fix | Delete
* @param {jQuery} topSelector The top selector element.
[1224] Fix | Delete
* @param {jQuery} topSubmit The top submit element.
[1225] Fix | Delete
* @param {jQuery} bottomSelector The bottom selector element.
[1226] Fix | Delete
* @param {jQuery} bottomSubmit The bottom submit element.
[1227] Fix | Delete
* @return {void}
[1228] Fix | Delete
*/
[1229] Fix | Delete
function marryControls( topSelector, topSubmit, bottomSelector, bottomSubmit ) {
[1230] Fix | Delete
/**
[1231] Fix | Delete
* Updates the primary selector when the secondary selector is changed.
[1232] Fix | Delete
*
[1233] Fix | Delete
* @since 5.7.0
[1234] Fix | Delete
*
[1235] Fix | Delete
* @return {void}
[1236] Fix | Delete
*/
[1237] Fix | Delete
function updateTopSelector() {
[1238] Fix | Delete
topSelector.val($(this).val());
[1239] Fix | Delete
}
[1240] Fix | Delete
bottomSelector.on('change', updateTopSelector);
[1241] Fix | Delete
[1242] Fix | Delete
/**
[1243] Fix | Delete
* Updates the secondary selector when the primary selector is changed.
[1244] Fix | Delete
*
[1245] Fix | Delete
* @since 5.7.0
[1246] Fix | Delete
*
[1247] Fix | Delete
* @return {void}
[1248] Fix | Delete
*/
[1249] Fix | Delete
function updateBottomSelector() {
[1250] Fix | Delete
bottomSelector.val($(this).val());
[1251] Fix | Delete
}
[1252] Fix | Delete
topSelector.on('change', updateBottomSelector);
[1253] Fix | Delete
[1254] Fix | Delete
/**
[1255] Fix | Delete
* Triggers the primary submit when then secondary submit is clicked.
[1256] Fix | Delete
*
[1257] Fix | Delete
* @since 5.7.0
[1258] Fix | Delete
*
[1259] Fix | Delete
* @return {void}
[1260] Fix | Delete
*/
[1261] Fix | Delete
function triggerSubmitClick(e) {
[1262] Fix | Delete
e.preventDefault();
[1263] Fix | Delete
e.stopPropagation();
[1264] Fix | Delete
[1265] Fix | Delete
topSubmit.trigger('click');
[1266] Fix | Delete
}
[1267] Fix | Delete
bottomSubmit.on('click', triggerSubmitClick);
[1268] Fix | Delete
}
[1269] Fix | Delete
[1270] Fix | Delete
// Marry the secondary "Bulk actions" controls to the primary controls:
[1271] Fix | Delete
marryControls( $('#bulk-action-selector-top'), $('#doaction'), $('#bulk-action-selector-bottom'), $('#doaction2') );
[1272] Fix | Delete
[1273] Fix | Delete
// Marry the secondary "Change role to" controls to the primary controls:
[1274] Fix | Delete
marryControls( $('#new_role'), $('#changeit'), $('#new_role2'), $('#changeit2') );
[1275] Fix | Delete
[1276] Fix | Delete
/**
[1277] Fix | Delete
* Shows row actions on focus of its parent container element or any other elements contained within.
[1278] Fix | Delete
*
[1279] Fix | Delete
* @return {void}
[1280] Fix | Delete
*/
[1281] Fix | Delete
$( '#wpbody-content' ).on({
[1282] Fix | Delete
focusin: function() {
[1283] Fix | Delete
clearTimeout( transitionTimeout );
[1284] Fix | Delete
focusedRowActions = $( this ).find( '.row-actions' );
[1285] Fix | Delete
// transitionTimeout is necessary for Firefox, but Chrome won't remove the CSS class without a little help.
[1286] Fix | Delete
$( '.row-actions' ).not( this ).removeClass( 'visible' );
[1287] Fix | Delete
focusedRowActions.addClass( 'visible' );
[1288] Fix | Delete
},
[1289] Fix | Delete
focusout: function() {
[1290] Fix | Delete
// Tabbing between post title and .row-actions links needs a brief pause, otherwise
[1291] Fix | Delete
// the .row-actions div gets hidden in transit in some browsers (ahem, Firefox).
[1292] Fix | Delete
transitionTimeout = setTimeout( function() {
[1293] Fix | Delete
focusedRowActions.removeClass( 'visible' );
[1294] Fix | Delete
}, 30 );
[1295] Fix | Delete
}
[1296] Fix | Delete
}, '.table-view-list .has-row-actions' );
[1297] Fix | Delete
[1298] Fix | Delete
// Toggle list table rows on small screens.
[1299] Fix | Delete
$( 'tbody' ).on( 'click', '.toggle-row', function() {
[1300] Fix | Delete
$( this ).closest( 'tr' ).toggleClass( 'is-expanded' );
[1301] Fix | Delete
});
[1302] Fix | Delete
[1303] Fix | Delete
$('#default-password-nag-no').on( 'click', function() {
[1304] Fix | Delete
setUserSetting('default_password_nag', 'hide');
[1305] Fix | Delete
$('div.default-password-nag').hide();
[1306] Fix | Delete
return false;
[1307] Fix | Delete
});
[1308] Fix | Delete
[1309] Fix | Delete
/**
[1310] Fix | Delete
* Handles tab keypresses in theme and plugin editor textareas.
[1311] Fix | Delete
*
[1312] Fix | Delete
* @param {Event} e The event object.
[1313] Fix | Delete
*
[1314] Fix | Delete
* @return {void}
[1315] Fix | Delete
*/
[1316] Fix | Delete
$('#newcontent').on('keydown.wpevent_InsertTab', function(e) {
[1317] Fix | Delete
var el = e.target, selStart, selEnd, val, scroll, sel;
[1318] Fix | Delete
[1319] Fix | Delete
// After pressing escape key (keyCode: 27), the tab key should tab out of the textarea.
[1320] Fix | Delete
if ( e.keyCode == 27 ) {
[1321] Fix | Delete
// When pressing Escape: Opera 12 and 27 blur form fields, IE 8 clears them.
[1322] Fix | Delete
e.preventDefault();
[1323] Fix | Delete
$(el).data('tab-out', true);
[1324] Fix | Delete
return;
[1325] Fix | Delete
}
[1326] Fix | Delete
[1327] Fix | Delete
// Only listen for plain tab key (keyCode: 9) without any modifiers.
[1328] Fix | Delete
if ( e.keyCode != 9 || e.ctrlKey || e.altKey || e.shiftKey )
[1329] Fix | Delete
return;
[1330] Fix | Delete
[1331] Fix | Delete
// After tabbing out, reset it so next time the tab key can be used again.
[1332] Fix | Delete
if ( $(el).data('tab-out') ) {
[1333] Fix | Delete
$(el).data('tab-out', false);
[1334] Fix | Delete
return;
[1335] Fix | Delete
}
[1336] Fix | Delete
[1337] Fix | Delete
selStart = el.selectionStart;
[1338] Fix | Delete
selEnd = el.selectionEnd;
[1339] Fix | Delete
val = el.value;
[1340] Fix | Delete
[1341] Fix | Delete
// If any text is selected, replace the selection with a tab character.
[1342] Fix | Delete
if ( document.selection ) {
[1343] Fix | Delete
el.focus();
[1344] Fix | Delete
sel = document.selection.createRange();
[1345] Fix | Delete
sel.text = '\t';
[1346] Fix | Delete
} else if ( selStart >= 0 ) {
[1347] Fix | Delete
scroll = this.scrollTop;
[1348] Fix | Delete
el.value = val.substring(0, selStart).concat('\t', val.substring(selEnd) );
[1349] Fix | Delete
el.selectionStart = el.selectionEnd = selStart + 1;
[1350] Fix | Delete
this.scrollTop = scroll;
[1351] Fix | Delete
}
[1352] Fix | Delete
[1353] Fix | Delete
// Cancel the regular tab functionality, to prevent losing focus of the textarea.
[1354] Fix | Delete
if ( e.stopPropagation )
[1355] Fix | Delete
e.stopPropagation();
[1356] Fix | Delete
if ( e.preventDefault )
[1357] Fix | Delete
e.preventDefault();
[1358] Fix | Delete
});
[1359] Fix | Delete
[1360] Fix | Delete
// Reset page number variable for new filters/searches but not for bulk actions. See #17685.
[1361] Fix | Delete
if ( pageInput.length ) {
[1362] Fix | Delete
[1363] Fix | Delete
/**
[1364] Fix | Delete
* Handles pagination variable when filtering the list table.
[1365] Fix | Delete
*
[1366] Fix | Delete
* Set the pagination argument to the first page when the post-filter form is submitted.
[1367] Fix | Delete
* This happens when pressing the 'filter' button on the list table page.
[1368] Fix | Delete
*
[1369] Fix | Delete
* The pagination argument should not be touched when the bulk action dropdowns are set to do anything.
[1370] Fix | Delete
*
[1371] Fix | Delete
* The form closest to the pageInput is the post-filter form.
[1372] Fix | Delete
*
[1373] Fix | Delete
* @return {void}
[1374] Fix | Delete
*/
[1375] Fix | Delete
pageInput.closest('form').on( 'submit', function() {
[1376] Fix | Delete
/*
[1377] Fix | Delete
* action = bulk action dropdown at the top of the table
[1378] Fix | Delete
*/
[1379] Fix | Delete
if ( $('select[name="action"]').val() == -1 && pageInput.val() == currentPage )
[1380] Fix | Delete
pageInput.val('1');
[1381] Fix | Delete
});
[1382] Fix | Delete
}
[1383] Fix | Delete
[1384] Fix | Delete
/**
[1385] Fix | Delete
* Resets the bulk actions when the search button is clicked.
[1386] Fix | Delete
*
[1387] Fix | Delete
* @return {void}
[1388] Fix | Delete
*/
[1389] Fix | Delete
$('.search-box input[type="search"], .search-box input[type="submit"]').on( 'mousedown', function () {
[1390] Fix | Delete
$('select[name^="action"]').val('-1');
[1391] Fix | Delete
});
[1392] Fix | Delete
[1393] Fix | Delete
/**
[1394] Fix | Delete
* Scrolls into view when focus.scroll-into-view is triggered.
[1395] Fix | Delete
*
[1396] Fix | Delete
* @param {Event} e The event object.
[1397] Fix | Delete
*
[1398] Fix | Delete
* @return {void}
[1399] Fix | Delete
*/
[1400] Fix | Delete
$('#contextual-help-link, #show-settings-link').on( 'focus.scroll-into-view', function(e){
[1401] Fix | Delete
if ( e.target.scrollIntoView )
[1402] Fix | Delete
e.target.scrollIntoView(false);
[1403] Fix | Delete
});
[1404] Fix | Delete
[1405] Fix | Delete
/**
[1406] Fix | Delete
* Disables the submit upload buttons when no data is entered.
[1407] Fix | Delete
*
[1408] Fix | Delete
* @return {void}
[1409] Fix | Delete
*/
[1410] Fix | Delete
(function(){
[1411] Fix | Delete
var button, input, form = $('form.wp-upload-form');
[1412] Fix | Delete
[1413] Fix | Delete
// Exit when no upload form is found.
[1414] Fix | Delete
if ( ! form.length )
[1415] Fix | Delete
return;
[1416] Fix | Delete
[1417] Fix | Delete
button = form.find('input[type="submit"]');
[1418] Fix | Delete
input = form.find('input[type="file"]');
[1419] Fix | Delete
[1420] Fix | Delete
/**
[1421] Fix | Delete
* Determines if any data is entered in any file upload input.
[1422] Fix | Delete
*
[1423] Fix | Delete
* @since 3.5.0
[1424] Fix | Delete
*
[1425] Fix | Delete
* @return {void}
[1426] Fix | Delete
*/
[1427] Fix | Delete
function toggleUploadButton() {
[1428] Fix | Delete
// When no inputs have a value, disable the upload buttons.
[1429] Fix | Delete
button.prop('disabled', '' === input.map( function() {
[1430] Fix | Delete
return $(this).val();
[1431] Fix | Delete
}).get().join(''));
[1432] Fix | Delete
}
[1433] Fix | Delete
[1434] Fix | Delete
// Update the status initially.
[1435] Fix | Delete
toggleUploadButton();
[1436] Fix | Delete
// Update the status when any file input changes.
[1437] Fix | Delete
input.on('change', toggleUploadButton);
[1438] Fix | Delete
})();
[1439] Fix | Delete
[1440] Fix | Delete
/**
[1441] Fix | Delete
* Pins the menu while distraction-free writing is enabled.
[1442] Fix | Delete
*
[1443] Fix | Delete
* @param {Event} event Event data.
[1444] Fix | Delete
*
[1445] Fix | Delete
* @since 4.1.0
[1446] Fix | Delete
*
[1447] Fix | Delete
* @return {void}
[1448] Fix | Delete
*/
[1449] Fix | Delete
function pinMenu( event ) {
[1450] Fix | Delete
var windowPos = $window.scrollTop(),
[1451] Fix | Delete
resizing = ! event || event.type !== 'scroll';
[1452] Fix | Delete
[1453] Fix | Delete
if ( isIOS || $adminmenu.data( 'wp-responsive' ) ) {
[1454] Fix | Delete
return;
[1455] Fix | Delete
}
[1456] Fix | Delete
[1457] Fix | Delete
/*
[1458] Fix | Delete
* When the menu is higher than the window and smaller than the entire page.
[1459] Fix | Delete
* It should be adjusted to be able to see the entire menu.
[1460] Fix | Delete
*
[1461] Fix | Delete
* Otherwise it can be accessed normally.
[1462] Fix | Delete
*/
[1463] Fix | Delete
if ( height.menu + height.adminbar < height.window ||
[1464] Fix | Delete
height.menu + height.adminbar + 20 > height.wpwrap ) {
[1465] Fix | Delete
unpinMenu();
[1466] Fix | Delete
return;
[1467] Fix | Delete
}
[1468] Fix | Delete
[1469] Fix | Delete
menuIsPinned = true;
[1470] Fix | Delete
[1471] Fix | Delete
// If the menu is higher than the window, compensate on scroll.
[1472] Fix | Delete
if ( height.menu + height.adminbar > height.window ) {
[1473] Fix | Delete
// Check for overscrolling, this happens when swiping up at the top of the document in modern browsers.
[1474] Fix | Delete
if ( windowPos < 0 ) {
[1475] Fix | Delete
// Stick the menu to the top.
[1476] Fix | Delete
if ( ! pinnedMenuTop ) {
[1477] Fix | Delete
pinnedMenuTop = true;
[1478] Fix | Delete
pinnedMenuBottom = false;
[1479] Fix | Delete
[1480] Fix | Delete
$adminMenuWrap.css({
[1481] Fix | Delete
position: 'fixed',
[1482] Fix | Delete
top: '',
[1483] Fix | Delete
bottom: ''
[1484] Fix | Delete
});
[1485] Fix | Delete
}
[1486] Fix | Delete
[1487] Fix | Delete
return;
[1488] Fix | Delete
} else if ( windowPos + height.window > $document.height() - 1 ) {
[1489] Fix | Delete
// When overscrolling at the bottom, stick the menu to the bottom.
[1490] Fix | Delete
if ( ! pinnedMenuBottom ) {
[1491] Fix | Delete
pinnedMenuBottom = true;
[1492] Fix | Delete
pinnedMenuTop = false;
[1493] Fix | Delete
[1494] Fix | Delete
$adminMenuWrap.css({
[1495] Fix | Delete
position: 'fixed',
[1496] Fix | Delete
top: '',
[1497] Fix | Delete
bottom: 0
[1498] Fix | Delete
});
[1499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function