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
Untitled diff
Créé
il y a 11 ans
Le diff n'expire jamais
Effacer
Exporter
Partager
Expliquer
19 suppressions
Lignes
Total
Supprimé
Caractères
Total
Supprimé
Pour continuer à utiliser cette fonctionnalité, passez à
Diff
checker
Pro
Voir les prix
66 lignes
Copier tout
61 ajouts
Lignes
Total
Ajouté
Caractères
Total
Ajouté
Pour continuer à utiliser cette fonctionnalité, passez à
Diff
checker
Pro
Voir les prix
68 lignes
Copier tout
Copier
Copié
Copier
Copié
//
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;
Copier
Copié
Copier
Copié
//
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");
});
});
Copier
Copié
Copier
Copié
//
When "New Color" is
pressed
//
When "New Color" is
clicked
$("#revealColorSelect").click(function(){
$("#revealColorSelect").click(function(){
Copier
Copié
Copier
Copié
//
Show color select or hide the color select
//
Show color select or hide the color select
changeColor();
changeColor();
$("#colorSelect").toggle();
$("#colorSelect").toggle();
});
});
Copier
Copié
Copier
Copié
//
u
pdate the new color span
//
U
pdate the new color span
function changeColor() {
function changeColor() {
Copier
Copié
Copier
Copié
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 + ")");
}
}
Copier
Copié
Copier
Copié
//
When color sliders change
//
When color sliders change
$("input[type=range]").change(changeColor);
$("input[type=range]").change(changeColor);
Copier
Copié
Copier
Copié
//
When "Add Color" is pressed
//
When "Add Color" is pressed
$("#addNewColor").click(function(){
$("#addNewColor").click(function(){
Copier
Copié
Copier
Copié
//
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();
});
});
Copier
Copié
Copier
Copié
//
On mouse event
s
on the canvas
//
On mouse event
on the canvas
$canvas.mousedown(function(e){
$canvas.mousedown(function(e){
Copier
Copié
Copier
Copié
lastEvent = e;
lastEvent = e;
mouseDown = true;
mouseDown = true;
}).mousemove(function(e){
}).mousemove(function(e){
Copier
Copié
Copier
Copié
//
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(){
Copier
Copié
Copier
Copié
mouseDown = false;
mouseDown = false;
}).mouse
L
eave(function(){
}).mouse
l
eave(function(){
$canvas.mouseup();
$canvas.mouseup();
});
});
Différences enregistrées
Texte d'origine
Ouvrir un fichier
//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(); });
Texte modifié
Ouvrir un fichier
// 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(); });
Trouver la différence