Diff
checker
Text
Text
Images
Documents
Excel
Folders
Legal
Enterprise
Desktop
Pricing
Sign in
Download Diffchecker Desktop
Compare text
Find the difference between two text files
Tools
History
Real-time editor
Hide unchanged lines
Disable line wrap
Layout
Split
Unified
Diff precision
Smart
Word
Char
Syntax highlighting
Choose syntax
Ignore
Transform text
Go to first change
Edit input
Diffchecker Desktop
The most secure way to run Diffchecker. Get the Diffchecker Desktop app: your diffs never leave your computer!
Get Desktop
inside out project STEP-104 to STEP-105 JavaScript Code Changes
Created
8 years ago
Diff never expires
Clear
Export
Share
Explain
30 removals
Lines
Total
Removed
Characters
Total
Removed
To continue using this feature, upgrade to
Diff
checker
Pro
View Pricing
79 lines
Copy
33 additions
Lines
Total
Added
Characters
Total
Added
To continue using this feature, upgrade to
Diff
checker
Pro
View Pricing
83 lines
Copy
Copy
Copied
Copy
Copied
//
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) {
Copy
Copied
Copy
Copied
$('nav').hide();
$('nav').hide();
Copy
Copied
Copy
Copied
var menu = menuBuilder(data.items);
var menu = menuBuilder(data.items);
Copy
Copied
Copy
Copied
$('nav').html(menu).slideDown();
$('nav').html(menu).slideDown();
Copy
Copied
Copy
Copied
$('nav
li a
').
click(function() {
//
$('nav
').
append(menu
);
getPage($(this).data("pgid"));
}
);
getPage(314);
$("#loaderDiv").fadeOut("slow");
$("#loaderDiv").fadeOut("slow");
Copy
Copied
Copy
Copied
},
},
error: function() {
error: function() {
Copy
Copied
Copy
Copied
console.log('all is not good');
console.log('all is not good');
Copy
Copied
Copy
Copied
}
}
});
});
Copy
Copied
Copy
Copied
}
}
Copy
Copied
Copy
Copied
function menuBuilder(obj) {
function menuBuilder(obj) {
Copy
Copied
Copy
Copied
var theMenu = '';
var theMenu = '';
Copy
Copied
Copy
Copied
if (obj.length > 0) {
if (obj.length > 0) {
Copy
Copied
Copy
Copied
theMenu = theMenu + '<ul>';
theMenu = theMenu + '<ul>';
Copy
Copied
Copy
Copied
obj.forEach(function(item) {
obj.forEach(function(item) {
Copy
Copied
Copy
Copied
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) {
Copy
Copied
Copy
Copied
theMenu = theMenu + menuBuilder(item.children);
theMenu = theMenu + menuBuilder(item.children);
Copy
Copied
Copy
Copied
}
}
Copy
Copied
Copy
Copied
theMenu = theMenu + '</li>';
theMenu = theMenu + '</li>';
Copy
Copied
Copy
Copied
});
});
Copy
Copied
Copy
Copied
theMenu = theMenu + '</ul>';
theMenu = theMenu + '</ul>';
Copy
Copied
Copy
Copied
} else {
} else {
Copy
Copied
Copy
Copied
console.log('no data');
console.log('no data');
Copy
Copied
Copy
Copied
}
}
Copy
Copied
Copy
Copied
return theMenu;
return theMenu;
}
}
Copy
Copied
Copy
Copied
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');
}
});
}
Saved diffs
Original text
Open file
// 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; }
Changed text
Open file
// 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'); } }); }
Find difference