Diff
checker
टेक्स्ट
टेक्स्ट
छवियां
दस्तावेज़
Excel
फ़ोल्डर्स
Legal
Enterprise
डेस्कटॉप
मूल्य
साइन इन करें
Diffchecker डेस्कटॉप डाउनलोड करें
टेक्स्ट की तुलना करें
दो टेक्स्ट फ़ाइलों के बीच अंतर ढूंढें
उपकरण
इतिहास
रियल-टाइम एडिटर
अपरिवर्तित संक्षिप्त करें
लाइन रैप बंद
लेआउट
विभाजित
संयुक्त
परिवर्तन हाइलाइट करें
स्मार्ट
शब्द
अक्षर
सिंटैक्स हाइलाइटिंग
सिंटैक्स चुनें
अनदेखा करें
टेक्स्ट बदलें
पहले अंतर पर जाएँ
इनपुट संपादित करें
Diffchecker Desktop
Diffchecker चलाने का सबसे सुरक्षित तरीका। Diffchecker Desktop ऐप पाएं: आपके diffs कभी आपके कंप्यूटर से बाहर नहीं जाते!
Desktop पाएं
_s Navigation dropdowns macOS Safari fix
बनाया गया
4 वर्ष पहले
Diff कभी समाप्त नहीं होता
साफ़
निर्यात करें
शेयर करें
समझाएं
0 हटाए गए
लाइनें
कुल
हटाया गया
अक्षर
कुल
हटाया गया
इस सुविधा का उपयोग जारी रखने के लिए, अपग्रेड करें
Diff
checker
Pro
मूल्य देखें
100 लाइनें
सभी को कॉपी करें
6 जोड़े गए
लाइनें
कुल
जोड़ा गया
अक्षर
कुल
जोड़ा गया
इस सुविधा का उपयोग जारी रखने के लिए, अपग्रेड करें
Diff
checker
Pro
मूल्य देखें
102 लाइनें
सभी को कॉपी करें
/**
/**
* File navigation.js.
* File navigation.js.
*
*
* Handles toggling the navigation menu for small screens and enables TAB key
* Handles toggling the navigation menu for small screens and enables TAB key
* navigation support for dropdown menus.
* navigation support for dropdown menus.
*/
*/
( function() {
( function() {
const siteNavigation = document.getElementById( 'site-navigation' );
const siteNavigation = document.getElementById( 'site-navigation' );
// Return early if the navigation doesn't exist.
// Return early if the navigation doesn't exist.
if ( ! siteNavigation ) {
if ( ! siteNavigation ) {
return;
return;
}
}
const button = siteNavigation.getElementsByTagName( 'button' )[ 0 ];
const button = siteNavigation.getElementsByTagName( 'button' )[ 0 ];
// Return early if the button doesn't exist.
// Return early if the button doesn't exist.
if ( 'undefined' === typeof button ) {
if ( 'undefined' === typeof button ) {
return;
return;
}
}
const menu = siteNavigation.getElementsByTagName( 'ul' )[ 0 ];
const menu = siteNavigation.getElementsByTagName( 'ul' )[ 0 ];
// Hide menu toggle button if menu is empty and return early.
// Hide menu toggle button if menu is empty and return early.
if ( 'undefined' === typeof menu ) {
if ( 'undefined' === typeof menu ) {
button.style.display = 'none';
button.style.display = 'none';
return;
return;
}
}
if ( ! menu.classList.contains( 'nav-menu' ) ) {
if ( ! menu.classList.contains( 'nav-menu' ) ) {
menu.classList.add( 'nav-menu' );
menu.classList.add( 'nav-menu' );
}
}
// Toggle the .toggled class and the aria-expanded value each time the button is clicked.
// Toggle the .toggled class and the aria-expanded value each time the button is clicked.
button.addEventListener( 'click', function() {
button.addEventListener( 'click', function() {
siteNavigation.classList.toggle( 'toggled' );
siteNavigation.classList.toggle( 'toggled' );
if ( button.getAttribute( 'aria-expanded' ) === 'true' ) {
if ( button.getAttribute( 'aria-expanded' ) === 'true' ) {
button.setAttribute( 'aria-expanded', 'false' );
button.setAttribute( 'aria-expanded', 'false' );
} else {
} else {
button.setAttribute( 'aria-expanded', 'true' );
button.setAttribute( 'aria-expanded', 'true' );
}
}
} );
} );
// Remove the .toggled class and set aria-expanded to false when the user clicks outside the navigation.
// Remove the .toggled class and set aria-expanded to false when the user clicks outside the navigation.
document.addEventListener( 'click', function( event ) {
document.addEventListener( 'click', function( event ) {
const isClickInside = siteNavigation.contains( event.target );
const isClickInside = siteNavigation.contains( event.target );
if ( ! isClickInside ) {
if ( ! isClickInside ) {
siteNavigation.classList.remove( 'toggled' );
siteNavigation.classList.remove( 'toggled' );
button.setAttribute( 'aria-expanded', 'false' );
button.setAttribute( 'aria-expanded', 'false' );
}
}
} );
} );
// Get all the link elements within the menu.
// Get all the link elements within the menu.
const links = menu.getElementsByTagName( 'a' );
const links = menu.getElementsByTagName( 'a' );
// Get all the link elements with children within the menu.
// Get all the link elements with children within the menu.
const linksWithChildren = menu.querySelectorAll( '.menu-item-has-children > a, .page_item_has_children > a' );
const linksWithChildren = menu.querySelectorAll( '.menu-item-has-children > a, .page_item_has_children > a' );
// Toggle focus each time a menu link is focused or blurred.
// Toggle focus each time a menu link is focused or blurred.
for ( const link of links ) {
for ( const link of links ) {
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
link.addEventListener( 'focus', toggleFocus, true );
// Disabled to fix submenus on iOS/Android
link.addEventListener( 'blur', toggleFocus, true );
//
link.addEventListener( 'focus', toggleFocus, true );
//
link.addEventListener( 'blur', toggleFocus, true );
}
}
// Toggle focus each time a menu link with children receive a touch event.
// Toggle focus each time a menu link with children receive a touch event.
for ( const link of linksWithChildren ) {
for ( const link of linksWithChildren ) {
link.addEventListener( 'touchstart', toggleFocus, false );
link.addEventListener( 'touchstart', toggleFocus, false );
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
link.addEventListener( 'click', toggleFocus, true ); // macOS Safari fix
}
}
/**
/**
* Sets or removes .focus class on an element.
* Sets or removes .focus class on an element.
*/
*/
function toggleFocus() {
function toggleFocus() {
if ( event.type === 'focus' || event.type === 'blur' ) {
if ( event.type === 'focus' || event.type === 'blur' ) {
let self = this;
let self = this;
// Move up through the ancestors of the current link until we hit .nav-menu.
// Move up through the ancestors of the current link until we hit .nav-menu.
while ( ! self.classList.contains( 'nav-menu' ) ) {
while ( ! self.classList.contains( 'nav-menu' ) ) {
// On li elements toggle the class .focus.
// On li elements toggle the class .focus.
if ( 'li' === self.tagName.toLowerCase() ) {
if ( 'li' === self.tagName.toLowerCase() ) {
self.classList.toggle( 'focus' );
self.classList.toggle( 'focus' );
}
}
self = self.parentNode;
self = self.parentNode;
}
}
}
}
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
if ( event.type ===
'touchstart' ) {
if ( event.type ===
'click' || event.type ===
'touchstart' ) {
// macOS Safari fix
const menuItem = this.parentNode;
const menuItem = this.parentNode;
event.preventDefault();
event.preventDefault();
for ( const link of menuItem.parentNode.children ) {
for ( const link of menuItem.parentNode.children ) {
if ( menuItem !== link ) {
if ( menuItem !== link ) {
link.classList.remove( 'focus' );
link.classList.remove( 'focus' );
}
}
}
}
menuItem.classList.toggle( 'focus' );
menuItem.classList.toggle( 'focus' );
}
}
}
}
}() );
}() );
सेव किए गए Diffs
ऑरिजनल टेक्स्ट
फ़ाइल खोलें
/** * File navigation.js. * * Handles toggling the navigation menu for small screens and enables TAB key * navigation support for dropdown menus. */ ( function() { const siteNavigation = document.getElementById( 'site-navigation' ); // Return early if the navigation doesn't exist. if ( ! siteNavigation ) { return; } const button = siteNavigation.getElementsByTagName( 'button' )[ 0 ]; // Return early if the button doesn't exist. if ( 'undefined' === typeof button ) { return; } const menu = siteNavigation.getElementsByTagName( 'ul' )[ 0 ]; // Hide menu toggle button if menu is empty and return early. if ( 'undefined' === typeof menu ) { button.style.display = 'none'; return; } if ( ! menu.classList.contains( 'nav-menu' ) ) { menu.classList.add( 'nav-menu' ); } // Toggle the .toggled class and the aria-expanded value each time the button is clicked. button.addEventListener( 'click', function() { siteNavigation.classList.toggle( 'toggled' ); if ( button.getAttribute( 'aria-expanded' ) === 'true' ) { button.setAttribute( 'aria-expanded', 'false' ); } else { button.setAttribute( 'aria-expanded', 'true' ); } } ); // Remove the .toggled class and set aria-expanded to false when the user clicks outside the navigation. document.addEventListener( 'click', function( event ) { const isClickInside = siteNavigation.contains( event.target ); if ( ! isClickInside ) { siteNavigation.classList.remove( 'toggled' ); button.setAttribute( 'aria-expanded', 'false' ); } } ); // Get all the link elements within the menu. const links = menu.getElementsByTagName( 'a' ); // Get all the link elements with children within the menu. const linksWithChildren = menu.querySelectorAll( '.menu-item-has-children > a, .page_item_has_children > a' ); // Toggle focus each time a menu link is focused or blurred. for ( const link of links ) { link.addEventListener( 'focus', toggleFocus, true ); link.addEventListener( 'blur', toggleFocus, true ); } // Toggle focus each time a menu link with children receive a touch event. for ( const link of linksWithChildren ) { link.addEventListener( 'touchstart', toggleFocus, false ); } /** * Sets or removes .focus class on an element. */ function toggleFocus() { if ( event.type === 'focus' || event.type === 'blur' ) { let self = this; // Move up through the ancestors of the current link until we hit .nav-menu. while ( ! self.classList.contains( 'nav-menu' ) ) { // On li elements toggle the class .focus. if ( 'li' === self.tagName.toLowerCase() ) { self.classList.toggle( 'focus' ); } self = self.parentNode; } } if ( event.type === 'touchstart' ) { const menuItem = this.parentNode; event.preventDefault(); for ( const link of menuItem.parentNode.children ) { if ( menuItem !== link ) { link.classList.remove( 'focus' ); } } menuItem.classList.toggle( 'focus' ); } } }() );
परिवर्तित टेक्स्ट
फ़ाइल खोलें
/** * File navigation.js. * * Handles toggling the navigation menu for small screens and enables TAB key * navigation support for dropdown menus. */ ( function() { const siteNavigation = document.getElementById( 'site-navigation' ); // Return early if the navigation doesn't exist. if ( ! siteNavigation ) { return; } const button = siteNavigation.getElementsByTagName( 'button' )[ 0 ]; // Return early if the button doesn't exist. if ( 'undefined' === typeof button ) { return; } const menu = siteNavigation.getElementsByTagName( 'ul' )[ 0 ]; // Hide menu toggle button if menu is empty and return early. if ( 'undefined' === typeof menu ) { button.style.display = 'none'; return; } if ( ! menu.classList.contains( 'nav-menu' ) ) { menu.classList.add( 'nav-menu' ); } // Toggle the .toggled class and the aria-expanded value each time the button is clicked. button.addEventListener( 'click', function() { siteNavigation.classList.toggle( 'toggled' ); if ( button.getAttribute( 'aria-expanded' ) === 'true' ) { button.setAttribute( 'aria-expanded', 'false' ); } else { button.setAttribute( 'aria-expanded', 'true' ); } } ); // Remove the .toggled class and set aria-expanded to false when the user clicks outside the navigation. document.addEventListener( 'click', function( event ) { const isClickInside = siteNavigation.contains( event.target ); if ( ! isClickInside ) { siteNavigation.classList.remove( 'toggled' ); button.setAttribute( 'aria-expanded', 'false' ); } } ); // Get all the link elements within the menu. const links = menu.getElementsByTagName( 'a' ); // Get all the link elements with children within the menu. const linksWithChildren = menu.querySelectorAll( '.menu-item-has-children > a, .page_item_has_children > a' ); // Toggle focus each time a menu link is focused or blurred. for ( const link of links ) { // Disabled to fix submenus on iOS/Android //link.addEventListener( 'focus', toggleFocus, true ); //link.addEventListener( 'blur', toggleFocus, true ); } // Toggle focus each time a menu link with children receive a touch event. for ( const link of linksWithChildren ) { link.addEventListener( 'touchstart', toggleFocus, false ); link.addEventListener( 'click', toggleFocus, true ); // macOS Safari fix } /** * Sets or removes .focus class on an element. */ function toggleFocus() { if ( event.type === 'focus' || event.type === 'blur' ) { let self = this; // Move up through the ancestors of the current link until we hit .nav-menu. while ( ! self.classList.contains( 'nav-menu' ) ) { // On li elements toggle the class .focus. if ( 'li' === self.tagName.toLowerCase() ) { self.classList.toggle( 'focus' ); } self = self.parentNode; } } if ( event.type === 'click' || event.type === 'touchstart' ) { // macOS Safari fix const menuItem = this.parentNode; event.preventDefault(); for ( const link of menuItem.parentNode.children ) { if ( menuItem !== link ) { link.classList.remove( 'focus' ); } } menuItem.classList.toggle( 'focus' ); } } }() );
अंतर खोजें