Diff
checker
Texte
Texte
Images
Documents
Excel
Dossiers
Legal
Enterprise
Application de bureau
Prix
Se connecter
Télécharger Diffchecker Desktop
Comparer le texte
Trouver la différence entre deux fichiers texte
Outils
Historique
Éditeur live
Cacher identiques
Sans retour à la ligne
Vue
Divisé
Unifié
Niveau de précision
Intelligent
Mot
Caractère
Coloration syntaxique
Choisir la syntaxe
Ignorer
Transformer le texte
Aller au premier écart
Modifier l'entrée
Diffchecker Desktop
La façon la plus sécurisée d'utiliser Diffchecker. Obtenez l'application Diffchecker Desktop : vos diffs ne quittent jamais votre ordinateur !
Obtenir Desktop
inside out project STEP-104 to STEP-105 JavaScript Code Changes
Créé
il y a 8 ans
Le diff n'expire jamais
Effacer
Exporter
Partager
Expliquer
30 suppressions
Lignes
Total
Supprimé
Caractères
Total
Supprimé
Pour continuer à utiliser cette fonctionnalité, passez à
Diff
checker
Pro
Voir les prix
79 lignes
Copier tout
33 ajouts
Lignes
Total
Ajouté
Caractères
Total
Ajouté
Pour continuer à utiliser cette fonctionnalité, passez à
Diff
checker
Pro
Voir les prix
83 lignes
Copier tout
Copier
Copié
Copier
Copié
//
JavaScript Document
//
inside out project STEP-105
window.onload = init();
window.onload = init();
function init() {
function init() {
window.addEventListener('scroll', function(e) {
window.addEventListener('scroll', function(e) {
var distanceY = window.pageYOffset || document.documentElement.scrollTop,
var distanceY = window.pageYOffset || document.documentElement.scrollTop,
shrinkOn = 300,
shrinkOn = 300,
header = document.querySelector("header");
header = document.querySelector("header");
if (distanceY > shrinkOn) {
if (distanceY > shrinkOn) {
classie.add(header, "smaller");
classie.add(header, "smaller");
} else {
} else {
if (classie.has(header, "smaller")) {
if (classie.has(header, "smaller")) {
classie.remove(header, "smaller");
classie.remove(header, "smaller");
}
}
}
}
});
});
$.ajax({
$.ajax({
method: 'GET',
method: 'GET',
url: 'https://me.inside-out-project.com/wp-json/wp-api-menus/v2/menus/3',
url: 'https://me.inside-out-project.com/wp-json/wp-api-menus/v2/menus/3',
dataType: 'json',
dataType: 'json',
success: function(data) {
success: function(data) {
Copier
Copié
Copier
Copié
$('nav').hide();
$('nav').hide();
Copier
Copié
Copier
Copié
var menu = menuBuilder(data.items);
var menu = menuBuilder(data.items);
Copier
Copié
Copier
Copié
$('nav').html(menu).slideDown();
$('nav').html(menu).slideDown();
Copier
Copié
Copier
Copié
$('nav
li a
').
click(function() {
//
$('nav
').
append(menu
);
getPage($(this).data("pgid"));
}
);
getPage(314);
$("#loaderDiv").fadeOut("slow");
$("#loaderDiv").fadeOut("slow");
Copier
Copié
Copier
Copié
},
},
error: function() {
error: function() {
Copier
Copié
Copier
Copié
console.log('all is not good');
console.log('all is not good');
Copier
Copié
Copier
Copié
}
}
});
});
Copier
Copié
Copier
Copié
}
}
Copier
Copié
Copier
Copié
function menuBuilder(obj) {
function menuBuilder(obj) {
Copier
Copié
Copier
Copié
var theMenu = '';
var theMenu = '';
Copier
Copié
Copier
Copié
if (obj.length > 0) {
if (obj.length > 0) {
Copier
Copié
Copier
Copié
theMenu = theMenu + '<ul>';
theMenu = theMenu + '<ul>';
Copier
Copié
Copier
Copié
obj.forEach(function(item) {
obj.forEach(function(item) {
Copier
Copié
Copier
Copié
theMenu = theMenu + '<li><a href="#
" data-pgid="' + item.object_id + '
">' + item.title + '</a>';
theMenu = theMenu + '<li><a href="#
">' + item.title + '</a>';
if (item.children) {
if (item.children) {
Copier
Copié
Copier
Copié
theMenu = theMenu + menuBuilder(item.children);
theMenu = theMenu + menuBuilder(item.children);
Copier
Copié
Copier
Copié
}
}
Copier
Copié
Copier
Copié
theMenu = theMenu + '</li>';
theMenu = theMenu + '</li>';
Copier
Copié
Copier
Copié
});
});
Copier
Copié
Copier
Copié
theMenu = theMenu + '</ul>';
theMenu = theMenu + '</ul>';
Copier
Copié
Copier
Copié
} else {
} else {
Copier
Copié
Copier
Copié
console.log('no data');
console.log('no data');
Copier
Copié
Copier
Copié
}
}
Copier
Copié
Copier
Copié
return theMenu;
return theMenu;
}
}
Copier
Copié
Copier
Copié
function getPage(obj) {
$("#loaderDiv").fadeIn("slow");
$.ajax({
method: 'GET',
url: 'https://me.inside-out-project.com/wp-json/wp/v2/pages/' + obj,
dataType: 'json',
success: function(data) {
var pgbuild = '';
pgbuild = '<section><div class="container">' + data.content.rendered + '</div></section>';
$("#content").fadeOut(function() {
$('html').animate({
scrollTop: 0
}, 'slow'); //IE, FF
$('body').animate({
scrollTop: 0
}, 'slow'); //chrome, don't know if Safari works
$(this).html(pgbuild).fadeIn();
$("#loaderDiv").fadeOut("slow");
});
},
error: function() {
console.log('bad');
}
});
}
Différences enregistrées
Texte d'origine
Ouvrir un fichier
// JavaScript Document window.onload = init(); function init() { window.addEventListener('scroll', function(e) { var distanceY = window.pageYOffset || document.documentElement.scrollTop, shrinkOn = 300, header = document.querySelector("header"); if (distanceY > shrinkOn) { classie.add(header, "smaller"); } else { if (classie.has(header, "smaller")) { classie.remove(header, "smaller"); } } }); $.ajax({ method: 'GET', url: 'https://me.inside-out-project.com/wp-json/wp-api-menus/v2/menus/3', dataType: 'json', success: function(data) { $('nav').hide(); var menu = menuBuilder(data.items); $('nav').html(menu).slideDown(); // $('nav').append(menu); $("#loaderDiv").fadeOut("slow"); }, error: function() { console.log('all is not good'); } }); } function menuBuilder(obj) { var theMenu = ''; if (obj.length > 0) { theMenu = theMenu + '<ul>'; obj.forEach(function(item) { theMenu = theMenu + '<li><a href="#">' + item.title + '</a>'; if (item.children) { theMenu = theMenu + menuBuilder(item.children); } theMenu = theMenu + '</li>'; }); theMenu = theMenu + '</ul>'; } else { console.log('no data'); } return theMenu; }
Texte modifié
Ouvrir un fichier
// inside out project STEP-105 window.onload = init(); function init() { window.addEventListener('scroll', function(e) { var distanceY = window.pageYOffset || document.documentElement.scrollTop, shrinkOn = 300, header = document.querySelector("header"); if (distanceY > shrinkOn) { classie.add(header, "smaller"); } else { if (classie.has(header, "smaller")) { classie.remove(header, "smaller"); } } }); $.ajax({ method: 'GET', url: 'https://me.inside-out-project.com/wp-json/wp-api-menus/v2/menus/3', dataType: 'json', success: function(data) { $('nav').hide(); var menu = menuBuilder(data.items); $('nav').html(menu).slideDown(); $('nav li a').click(function() { getPage($(this).data("pgid")); }); getPage(314); $("#loaderDiv").fadeOut("slow"); }, error: function() { console.log('all is not good'); } }); } function menuBuilder(obj) { var theMenu = ''; if (obj.length > 0) { theMenu = theMenu + '<ul>'; obj.forEach(function(item) { theMenu = theMenu + '<li><a href="#" data-pgid="' + item.object_id + '">' + item.title + '</a>'; if (item.children) { theMenu = theMenu + menuBuilder(item.children); } theMenu = theMenu + '</li>'; }); theMenu = theMenu + '</ul>'; } else { console.log('no data'); } return theMenu; } function getPage(obj) { $("#loaderDiv").fadeIn("slow"); $.ajax({ method: 'GET', url: 'https://me.inside-out-project.com/wp-json/wp/v2/pages/' + obj, dataType: 'json', success: function(data) { var pgbuild = ''; pgbuild = '<section><div class="container">' + data.content.rendered + '</div></section>'; $("#content").fadeOut(function() { $('html').animate({ scrollTop: 0 }, 'slow'); //IE, FF $('body').animate({ scrollTop: 0 }, 'slow'); //chrome, don't know if Safari works $(this).html(pgbuild).fadeIn(); $("#loaderDiv").fadeOut("slow"); }); }, error: function() { console.log('bad'); } }); }
Trouver la différence