Diff
checker
Text
Text
Bilder
Dokumente
Excel
Ordner
Legal
Enterprise
Desktop-App
Preise
Einloggen
Diffchecker Desktop herunterladen
Texte vergleichen
Finde den Unterschied zwischen zwei Textdateien
Werkzeuge
Verlauf
Live-Editor
Gleiches ausblenden
Zeilenumbruch aus
Ansicht
Zweispaltig
Einspaltig
Vergleichsgenauigkeit
Intelligent
Wort
Zeichen
Syntaxhervorhebung
Syntax auswählen
Ignorieren
Text umwandeln
Zur ersten Änderung
Eingabe bearbeiten
Diffchecker Desktop
Der sicherste Weg, Diffchecker zu nutzen. Hol dir die Desktop-App: Deine Diffs verlassen nie deinen Computer!
Desktop holen
_s Navigation dropdowns macOS Safari fix
Erstellt
vor 4 Jahren
Diff läuft nie ab
Löschen
Exportieren
Teilen
Erklären
0 Entfernungen
Zeilen
Gesamt
Entfernt
Zeichen
Gesamt
Entfernt
Um diese Funktion weiterhin zu nutzen, aktualisiere auf
Diff
checker
Pro
Preise anzeigen
100 Zeilen
Kopieren
6 Hinzufügungen
Zeilen
Gesamt
Hinzugefügt
Zeichen
Gesamt
Hinzugefügt
Um diese Funktion weiterhin zu nutzen, aktualisiere auf
Diff
checker
Pro
Preise anzeigen
102 Zeilen
Kopieren
/**
/**
* 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 ) {
Kopieren
Kopiert
Kopieren
Kopiert
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 );
Kopieren
Kopiert
Kopieren
Kopiert
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;
}
}
}
}
Kopieren
Kopiert
Kopieren
Kopiert
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' );
}
}
}
}
}() );
}() );
Gespeicherte Diffs
Originaltext
Datei öffnen
/** * 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' ); } } }() );
Bearbeitung
Datei öffnen
/** * 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' ); } } }() );
Unterschied finden