You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.1 KiB

Component({
properties: {
data:{
type:Object,
observer:function(){
this.analyse();
}
},
index: Number
},
data: {
hidden:true,
scrollTop1:0,
scrollTop2:0
},
methods: {
analyse(){
;
let {output="",actual_output=""} = this.data.data;
;
output = output||"";
actual_output = actual_output||"";
;
var outputs = output.split(/\n/).map(i=>({text:i}));
var actual_outputs = actual_output.split(/\n/).map(i=>({text:i}));
var lines = Math.min(outputs.length, actual_outputs.length);
for(var i=0;i<lines;i++){
if(outputs[i].text!=actual_outputs[i].text){
actual_outputs[i].class = outputs[i].class = "different";
}
}
this.setData({outputs, actual_outputs});
;
},
scroll1({scrollTop1}){
this.setData({scrollTop1});
},
scroll2({scrollTop2}){
this.setData({scrollTop2});
},
onTapHeader(){
var {hidden} = this.data;
hidden = !this.data.data.is_public||!hidden;
this.setData({hidden});
}
}
})