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'); } }); }
尋找差異