Diff
checker
文本
文本
图像
文档
Excel
文件夹
Legal
Enterprise
桌面版
定价
登录
下载 Diffchecker 桌面版
比较文本
查找两个文本文件之间的差异
工具
历史
实时编辑器
折叠未更改行
关闭换行
视图
拆分
统一
比对精度
智能
单词
字符
语法高亮
选择语法
忽略
文本转换
转到第一个差异
编辑输入
Diffchecker Desktop
运行Diffchecker最安全的方式。获取Diffchecker桌面应用:您的差异永远不会离开您的电脑!
获取桌面版
inside out project STEP-104 to STEP-105 JavaScript Code Changes
创建于
8年前
差异永不过期
清除
导出
分享
解释
30 删除
行
总计
删除
字符
总计
删除
要继续使用此功能,请升级到
Diff
checker
Pro
查看价格
79 行
全部复制
33 添加
行
总计
添加
字符
总计
添加
要继续使用此功能,请升级到
Diff
checker
Pro
查看价格
83 行
全部复制
复制
已复制
复制
已复制
//
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) {
复制
已复制
复制
已复制
$('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
').
append(menu
);
getPage($(this).data("pgid"));
}
);
getPage(314);
$("#loaderDiv").fadeOut("slow");
$("#loaderDiv").fadeOut("slow");
复制
已复制
复制
已复制
},
},
error: function() {
error: function() {
复制
已复制
复制
已复制
console.log('all is not good');
console.log('all is not good');
复制
已复制
复制
已复制
}
}
});
});
复制
已复制
复制
已复制
}
}
复制
已复制
复制
已复制
function menuBuilder(obj) {
function menuBuilder(obj) {
复制
已复制
复制
已复制
var theMenu = '';
var theMenu = '';
复制
已复制
复制
已复制
if (obj.length > 0) {
if (obj.length > 0) {
复制
已复制
复制
已复制
theMenu = theMenu + '<ul>';
theMenu = theMenu + '<ul>';
复制
已复制
复制
已复制
obj.forEach(function(item) {
obj.forEach(function(item) {
复制
已复制
复制
已复制
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) {
复制
已复制
复制
已复制
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;
}
}
复制
已复制
复制
已复制
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');
}
});
}
已保存差异
原始文本
打开文件
// 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; }
更改后文本
打开文件
// 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'); } }); }
查找差异