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-106 to STEP-107 app.js Code Changes
Créé
il y a 8 ans
Le diff n'expire jamais
Effacer
Exporter
Partager
Expliquer
8 suppressions
Lignes
Total
Supprimé
Caractères
Total
Supprimé
Pour continuer à utiliser cette fonctionnalité, passez à
Diff
checker
Pro
Voir les prix
104 lignes
Copier tout
38 ajouts
Lignes
Total
Ajouté
Caractères
Total
Ajouté
Pour continuer à utiliser cette fonctionnalité, passez à
Diff
checker
Pro
Voir les prix
128 lignes
Copier tout
// inside out project STEP-106
// inside out project STEP-106
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) {
$('nav').hide();
$('nav').hide();
var menu = menuBuilder(data.items);
var menu = menuBuilder(data.items);
$('nav').html(menu).slideDown();
$('nav').html(menu).slideDown();
$('nav li a').click(function() {
$('nav li a').click(function() {
Copier
Copié
Copier
Copié
getPage($(this).data("pgid")
);
getPage($(this).data("pgid")
, $(this).data("callkind")
);
});
});
Copier
Copié
Copier
Copié
getPage(314
);
getPage(314
,'pages'
);
$("#loaderDiv").fadeOut("slow");
$("#loaderDiv").fadeOut("slow");
},
},
error: function() {
error: function() {
console.log('all is not good');
console.log('all is not good');
}
}
});
});
$.ajax({
$.ajax({
method: 'GET',
method: 'GET',
url: 'https://me.inside-out-project.com/wp-json/wp-api-menus/v2/menus/12',
url: 'https://me.inside-out-project.com/wp-json/wp-api-menus/v2/menus/12',
dataType: 'json',
dataType: 'json',
success: function (data) {
success: function (data) {
var menu = menuBuilder(data.items, 'genLinks', 'footer-ul');
var menu = menuBuilder(data.items, 'genLinks', 'footer-ul');
$('#genLinks').replaceWith(menu);
$('#genLinks').replaceWith(menu);
$('#genLinks li a').click(function () {
$('#genLinks li a').click(function () {
Copier
Copié
Copier
Copié
getPage($(this).data("pgid")
);
getPage($(this).data("pgid")
, $(this).data("callkind")
);
});
});
},
},
error: function () {
error: function () {
console.log('all is not good');
console.log('all is not good');
}
}
});
});
Copier
Copié
Copier
Copié
getPosts();
}
}
function menuBuilder(obj, targetEl, classInfo) {
function menuBuilder(obj, targetEl, classInfo) {
var theMenu = '';
var theMenu = '';
if (obj.length > 0) {
if (obj.length > 0) {
let target = (targetEl)?' id="'+targetEl+'"':'';
let target = (targetEl)?' id="'+targetEl+'"':'';
let elClass = (classInfo)?' class="'+classInfo+'"':'';
let elClass = (classInfo)?' class="'+classInfo+'"':'';
theMenu = theMenu + '<ul'+target+''+elClass+'>';
theMenu = theMenu + '<ul'+target+''+elClass+'>';
Copier
Copié
Copier
Copié
console.log(theMenu+' '+target);
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="#" data-pgid="' + item.object_id + '
" data-callkind="pages
">' + item.title + '</a>';
if (item.children) {
if (item.children) {
theMenu = theMenu + menuBuilder(item.children);
theMenu = theMenu + menuBuilder(item.children);
}
}
theMenu = theMenu + '</li>';
theMenu = theMenu + '</li>';
});
});
theMenu = theMenu + '</ul>';
theMenu = theMenu + '</ul>';
} else {
} else {
console.log('no data');
console.log('no data');
}
}
return theMenu;
return theMenu;
}
}
Copier
Copié
Copier
Copié
function getPage(obj
) {
function getPage(obj
Id, objType
) {
$("#loaderDiv").fadeIn("slow");
$("#loaderDiv").fadeIn("slow");
Copier
Copié
Copier
Copié
$('html').animate({scrollTop: 0}, 'slow');
$.ajax({
$.ajax({
method: 'GET',
method: 'GET',
Copier
Copié
Copier
Copié
url: 'https://me.inside-out-project.com/wp-json/wp/v2/
pages
/' + obj
,
url: 'https://me.inside-out-project.com/wp-json/wp/v2/
'+objType+'
/' + obj
Id
,
dataType: 'json',
dataType: 'json',
success: function(data) {
success: function(data) {
var pgbuild = '';
var pgbuild = '';
pgbuild = '<section><div class="container">' + data.content.rendered + '</div></section>';
pgbuild = '<section><div class="container">' + data.content.rendered + '</div></section>';
$("#content").fadeOut(function() {
$("#content").fadeOut(function() {
Copier
Copié
Copier
Copié
$('html').animate({
scrollTop: 0
}, 'slow'); //IE, FF
$('body').animate({
scrollTop: 0
}, 'slow'); //chrome, don't know if Safari works
$(this).html(pgbuild).fadeIn();
$(this).html(pgbuild).fadeIn();
$("#loaderDiv").fadeOut("slow");
$("#loaderDiv").fadeOut("slow");
});
});
},
},
error: function() {
error: function() {
console.log('bad');
console.log('bad');
}
}
});
});
}
}
Copier
Copié
Copier
Copié
function getPosts() {
$.ajax({
method: 'GET',
url: 'https://me.inside-out-project.com/wp-json/wp/v2/posts?orderby=date&order=asc&per_page=5',
dataType: 'json',
success: function (data) {
$("#latestPosts").html('<p id="postLdr"><i class="fa fa-cogs"></i> Loading Posts</p>');
data.forEach(function (item) {
var myDate = new Date(item.date);
$("#latestPosts").prepend('<p><a href="#" data-pgid="' + item.id + '" data-callkind="posts">' + item.title.rendered + '<span>' + myDate.getMonth() + '-' + myDate.getDay() + '-' + myDate.getFullYear() + '</span></a></p>');
});
$('#latestPosts p a').click(function () {
getPage($(this).data("pgid"), $(this).data("callkind"));
});
$("#postLdr").remove();
},
error: function () {
console.log('bad');
}
});
}
Différences enregistrées
Texte d'origine
Ouvrir un fichier
// inside out project STEP-106 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'); } }); $.ajax({ method: 'GET', url: 'https://me.inside-out-project.com/wp-json/wp-api-menus/v2/menus/12', dataType: 'json', success: function (data) { var menu = menuBuilder(data.items, 'genLinks', 'footer-ul'); $('#genLinks').replaceWith(menu); $('#genLinks li a').click(function () { getPage($(this).data("pgid")); }); }, error: function () { console.log('all is not good'); } }); } function menuBuilder(obj, targetEl, classInfo) { var theMenu = ''; if (obj.length > 0) { let target = (targetEl)?' id="'+targetEl+'"':''; let elClass = (classInfo)?' class="'+classInfo+'"':''; theMenu = theMenu + '<ul'+target+''+elClass+'>'; console.log(theMenu+' '+target); 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'); } }); }
Texte modifié
Ouvrir un fichier
// inside out project STEP-106 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"), $(this).data("callkind")); }); getPage(314,'pages'); $("#loaderDiv").fadeOut("slow"); }, error: function() { console.log('all is not good'); } }); $.ajax({ method: 'GET', url: 'https://me.inside-out-project.com/wp-json/wp-api-menus/v2/menus/12', dataType: 'json', success: function (data) { var menu = menuBuilder(data.items, 'genLinks', 'footer-ul'); $('#genLinks').replaceWith(menu); $('#genLinks li a').click(function () { getPage($(this).data("pgid"), $(this).data("callkind")); }); }, error: function () { console.log('all is not good'); } }); getPosts(); } function menuBuilder(obj, targetEl, classInfo) { var theMenu = ''; if (obj.length > 0) { let target = (targetEl)?' id="'+targetEl+'"':''; let elClass = (classInfo)?' class="'+classInfo+'"':''; theMenu = theMenu + '<ul'+target+''+elClass+'>'; obj.forEach(function (item) { theMenu = theMenu + '<li><a href="#" data-pgid="' + item.object_id + '" data-callkind="pages">' + 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(objId, objType) { $("#loaderDiv").fadeIn("slow"); $('html').animate({scrollTop: 0}, 'slow'); $.ajax({ method: 'GET', url: 'https://me.inside-out-project.com/wp-json/wp/v2/'+objType+'/' + objId, dataType: 'json', success: function(data) { var pgbuild = ''; pgbuild = '<section><div class="container">' + data.content.rendered + '</div></section>'; $("#content").fadeOut(function() { $(this).html(pgbuild).fadeIn(); $("#loaderDiv").fadeOut("slow"); }); }, error: function() { console.log('bad'); } }); } function getPosts() { $.ajax({ method: 'GET', url: 'https://me.inside-out-project.com/wp-json/wp/v2/posts?orderby=date&order=asc&per_page=5', dataType: 'json', success: function (data) { $("#latestPosts").html('<p id="postLdr"><i class="fa fa-cogs"></i> Loading Posts</p>'); data.forEach(function (item) { var myDate = new Date(item.date); $("#latestPosts").prepend('<p><a href="#" data-pgid="' + item.id + '" data-callkind="posts">' + item.title.rendered + '<span>' + myDate.getMonth() + '-' + myDate.getDay() + '-' + myDate.getFullYear() + '</span></a></p>'); }); $('#latestPosts p a').click(function () { getPage($(this).data("pgid"), $(this).data("callkind")); }); $("#postLdr").remove(); }, error: function () { console.log('bad'); } }); }
Trouver la différence