- Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathtestcode.html
More file actions
Latest commit
95 lines (88 loc) · 2.94 KB
/
Copy pathtestcode.html
File metadata and controls
95 lines (88 loc) · 2.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<!doctype html>
<html>
<head>
<metacharset="utf-8">
<linkrel=stylesheethref="codediff.css">
<scriptsrc="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<linkrel="stylesheet" href="googlecode.css">
<scriptsrc="vendor/highlight.min.js"></script>
</head>
<body>
<p>Here's a sample code diff rendered with codediff.js:</p>
<divid="diffview">
</div>
<scriptsrc="difflib.js"></script>
<scriptsrc="dist/codediff.js"></script>
<scripttype="text/javascript">
functionrenderDiff(diffDiv,contentsBefore,contentsAfter){
diffDiv.appendChild(
codediff.buildView(
contentsBefore,
contentsAfter,
{
language: 'js',
// wordWrap: true,
}
)
);
}
</script>
<scripttype="notjavascript" id="before">/**
* Convert a JS date to a string appropriate to display on an axis that
* is displaying values at the stated granularity.
* @param {Date} date The date to format
* @param {number} granularity One of the Dygraph granularity constants
* @return {string} The formatted date
* @private
*/
Dygraph.dateAxisFormatter=function(date,granularity){
if(granularity>=Dygraph.DECADAL){
return''+date.getFullYear();
}elseif(granularity>=Dygraph.MONTHLY){
returnDygraph.SHORT_MONTH_NAMES_[date.getMonth()]+' '+date.getFullYear();
}else{
varfrac=date.getHours()*3600+date.getMinutes()*60+date.getSeconds()+date.getMilliseconds();
if(frac===0||granularity>=Dygraph.DAILY){
// e.g. '21Jan' (%d%b)
varnd=newDate(date.getTime()+3600*1000);
returnDygraph.zeropad(nd.getDate())+Dygraph.SHORT_MONTH_NAMES_[nd.getMonth()];
}else{
returnDygraph.hmsString_(date.getTime());
}
}
};
</script>
<scripttype="notjavascript" id="after">/**
* Convert a JS date to a string appropriate to display on an axis that
* @param {Date} date The date to format
* @param {number} granularity One of the Dygraph granularity constants
* @return {string} The formatted date
* @private
*/
Dygraph.dateAxisFormatter=function(date,granularity){
if(granularity>=Dygraph.DECADAL){
return'xx'+date.getFullYear();
}elseif(granularity>=Dygraph.MONTHLY){
returnDygraph.SHORT_MONTH_NAMES_[date.getMonth()]+' '+date.getFullYear();
}else{
varfrac=date.getHours()*3600+date.getMinutes()*60+
date.getSeconds()+date.getMilliseconds();
if(frac===0||granularity>=Dygraph.DAILY){
// e.g. '21Jan' (%d%b)
varnd=newDate(date.getTime()+3600*1000);
returnDygraph.zeropad(nd.getDate())+Dygraph.SHORT_MONTH_NAMES_[nd.getMonth()];
return"something else";
}else{
returnDygraph.hmsString_(date.getTime());
}
}
};
</script>
<scripttype="text/javascript">
varbeforeText=$("#before").html();
varafterText=$("#after").html();
vardiffDiv=$("#diffview").get(0);
renderDiff(diffDiv,beforeText,afterText);
</script>
</body>
</html>