Diff
checker
文本
文本
圖像
文檔
Excel
文件夾
Legal
Enterprise
桌面版
定價
登入
下載 Diffchecker 桌面版
比較文本
尋找兩個文字檔案之間的差異
工具
歷史
即時編輯器
摺疊未變更行
關閉換行
檢視
拆分
統一
比對精度
智能
單詞
字符
語法突出顯示
選擇語法
忽略
文字轉換
前往第一個差異
編輯輸入
Diffchecker Desktop
執行Diffchecker最安全的方式。取得Diffchecker桌面應用程式:您的差異永遠不會離開您的電腦!
取得桌面版
Untitled diff
建立於
11 年前
差異永不過期
清除
匯出
分享
解釋
19 刪除
行
總計
刪除
字符
總計
刪除
要繼續使用此功能,請升級到
Diff
checker
Pro
查看價格
66 行
全部複製
61 新增
行
總計
新增
字符
總計
新增
要繼續使用此功能,請升級到
Diff
checker
Pro
查看價格
68 行
全部複製
複製
已複製
複製
已複製
//
Problem: No user interaction causes no change to application
//
Problem: No user interaction causes no change to application
.
//
Solution: When user interacts
cause changes appropriately
//
Solution: When user interacts
,
cause changes appropriately
.
var color = $(".selected").css("background-color");
var color = $(".selected").css("background-color");
var $canvas = $("canvas");
var $canvas = $("canvas");
var context = $canvas[0].getContext("2d");
var context = $canvas[0].getContext("2d");
var lastEvent;
var lastEvent;
var mouseDown = false;
var mouseDown = false;
複製
已複製
複製
已複製
//
When clicking on control list items
//
When clicking on control list items
$(".controls").on("click", "li", function()
{
$(".controls").on("click", "li", function()
{
//
Deselect sibling elements
//
Deselect sibling elements
$(this).siblings().removeClass("selected");
$(this).siblings().removeClass("selected");
//
Select clicked element
//
Select clicked element
$(this).addClass("selected");
$(this).addClass("selected");
// C
ache current color
//c
ache current color
color = $(this).css("background-color");
color = $(this).css("background-color");
});
});
複製
已複製
複製
已複製
//
When "New Color" is
pressed
//
When "New Color" is
clicked
$("#revealColorSelect").click(function(){
$("#revealColorSelect").click(function(){
複製
已複製
複製
已複製
//
Show color select or hide the color select
//
Show color select or hide the color select
changeColor();
changeColor();
$("#colorSelect").toggle();
$("#colorSelect").toggle();
});
});
複製
已複製
複製
已複製
//
u
pdate the new color span
//
U
pdate the new color span
function changeColor() {
function changeColor() {
複製
已複製
複製
已複製
var r = $("#red").val();
var r = $("#red").val();
var g = $("#green").val();
var g = $("#green").val();
var b = $("#blue").val();
var b = $("#blue").val();
$("#newColor").css("background-color", "rgb(" + r + "," + g +
",
" + b + ")");
$("#newColor").css("background-color", "rgb(" + r + "," + g +
",
" + b + ")");
}
}
複製
已複製
複製
已複製
//
When color sliders change
//
When color sliders change
$("input[type=range]").change(changeColor);
$("input[type=range]").change(changeColor);
複製
已複製
複製
已複製
//
When "Add Color" is pressed
//
When "Add Color" is pressed
$("#addNewColor").click(function(){
$("#addNewColor").click(function(){
複製
已複製
複製
已複製
//
Append the color to the control
s ul
//
Append the color to the control
list
var $newColor = $("<li></li>");
var $newColor = $("<li></li>");
$newColor.css("background-color", $("#newColor").css("background-color"));
$newColor.css("background-color", $("#newColor").css("background-color"));
$(".controls ul").append($newColor);
$(".controls ul").append($newColor);
//
Select the new color
//
Select the new color
$newColor.click();
$newColor.click();
});
});
複製
已複製
複製
已複製
//
On mouse event
s
on the canvas
//
On mouse event
on the canvas
$canvas.mousedown(function(e){
$canvas.mousedown(function(e){
複製
已複製
複製
已複製
lastEvent = e;
lastEvent = e;
mouseDown = true;
mouseDown = true;
}).mousemove(function(e){
}).mousemove(function(e){
複製
已複製
複製
已複製
//
Draw lines
//
Draw lines
if(mouseDown) {
if(mouseDown) {
context.beginPath();
context.beginPath();
context.moveTo(lastEvent.offset
x
, lastEvent.offset
y
);
context.moveTo(lastEvent.offset
X
, lastEvent.offset
Y
);
context.lineTo(e.offset
x
, e.offset
y
);
context.lineTo(e.offset
X
, e.offset
Y
);
context.strokeStyle = color;
context.strokeStyle = color;
context.stroke();
context.stroke();
lastEvent = e;
lastEvent = e;
}
}
}).mouseup(function(){
}).mouseup(function(){
複製
已複製
複製
已複製
mouseDown = false;
mouseDown = false;
}).mouse
L
eave(function(){
}).mouse
l
eave(function(){
$canvas.mouseup();
$canvas.mouseup();
});
});
已保存差異
原始文本
開啟檔案
//Problem: No user interaction causes no change to application //Solution: When user interacts cause changes appropriately var color = $(".selected").css("background-color"); var $canvas = $("canvas"); var context = $canvas[0].getContext("2d"); var lastEvent; var mouseDown = false; //When clicking on control list items $(".controls").on("click", "li", function(){ //Deselect sibling elements $(this).siblings().removeClass("selected"); //Select clicked element $(this).addClass("selected"); //cache current color color = $(this).css("background-color"); }); //When "New Color" is pressed $("#revealColorSelect").click(function(){ //Show color select or hide the color select changeColor(); $("#colorSelect").toggle(); }); //update the new color span function changeColor() { var r = $("#red").val(); var g = $("#green").val(); var b = $("#blue").val(); $("#newColor").css("background-color", "rgb(" + r + "," + g +", " + b + ")"); } //When color sliders change $("input[type=range]").change(changeColor); //When "Add Color" is pressed $("#addNewColor").click(function(){ //Append the color to the controls ul var $newColor = $("<li></li>"); $newColor.css("background-color", $("#newColor").css("background-color")); $(".controls ul").append($newColor); //Select the new color $newColor.click(); }); //On mouse events on the canvas $canvas.mousedown(function(e){ lastEvent = e; mouseDown = true; }).mousemove(function(e){ //Draw lines if(mouseDown) { context.beginPath(); context.moveTo(lastEvent.offsetx, lastEvent.offsety); context.lineTo(e.offsetx, e.offsety); context.strokeStyle = color; context.stroke(); lastEvent = e; } }).mouseup(function(){ mouseDown = false; }).mouseLeave(function(){ $canvas.mouseup(); });
更改後文本
開啟檔案
// Problem: No user interaction causes no change to application. // Solution: When user interacts, cause changes appropriately. var color = $(".selected").css("background-color"); var $canvas = $("canvas"); var context = $canvas[0].getContext("2d"); var lastEvent; var mouseDown = false; // When clicking on control list items $(".controls").on("click", "li", function() { // Deselect sibling elements $(this).siblings().removeClass("selected"); // Select clicked element $(this).addClass("selected"); // Cache current color color = $(this).css("background-color"); }); // When "New Color" is clicked $("#revealColorSelect").click(function(){ // Show color select or hide the color select changeColor(); $("#colorSelect").toggle(); }); // Update the new color span function changeColor() { var r = $("#red").val(); var g = $("#green").val(); var b = $("#blue").val(); $("#newColor").css("background-color", "rgb(" + r + "," + g + "," + b + ")"); } // When color sliders change $("input[type=range]").change(changeColor); // When "Add Color" is pressed $("#addNewColor").click(function(){ // Append the color to the control list var $newColor = $("<li></li>"); $newColor.css("background-color", $("#newColor").css("background-color")); $(".controls ul").append($newColor); // Select the new color $newColor.click(); }); // On mouse event on the canvas $canvas.mousedown(function(e){ lastEvent = e; mouseDown = true; }).mousemove(function(e){ // Draw lines if(mouseDown) { context.beginPath(); context.moveTo(lastEvent.offsetX, lastEvent.offsetY); context.lineTo(e.offsetX, e.offsetY); context.strokeStyle = color; context.stroke(); lastEvent = e; } }).mouseup(function(){ mouseDown = false; }).mouseleave(function(){ $canvas.mouseup(); });
尋找差異