forked from WardCunningham/Smallest-Federated-Wiki
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2c2fe35
commit 3372b50
Showing
6 changed files
with
80 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
formatTime = (time) -> | ||
d = new Date (if time > 10000000000 then time else time*1000) | ||
mo = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'][d.getMonth()] | ||
h = d.getHours() | ||
am = if h < 12 then 'AM' else 'PM' | ||
h = if h == 0 then 12 else if h > 12 then h - 12 else h | ||
mi = (if d.getMinutes() < 10 then "0" else "") + d.getMinutes() | ||
"#{h}:#{mi} #{am}<br>#{d.getDate()} #{mo} #{d.getFullYear()}" | ||
|
||
window.plugins.chart = | ||
emit: (div, item) -> | ||
chartElement = $('<p />').addClass('readout').appendTo(div).text(item.data.last().last()) | ||
captionElement = $('<p />').html(wiki.resolveLinks(item.caption)).appendTo(div) | ||
bind: (div, item) -> | ||
div.find('p:first').mousemove (e) -> | ||
[time, sample] = item.data[Math.floor(item.data.length * e.offsetX / e.target.offsetWidth)] | ||
$(e.target).text sample.toFixed(1) | ||
$(e.target).siblings("p").last().html formatTime(time) | ||
.dblclick -> | ||
wiki.dialog "JSON for #{item.caption}", $('<pre/>').text(JSON.stringify(item.data, null, 2)) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
(function() { | ||
var formatTime; | ||
|
||
formatTime = function(time) { | ||
var am, d, h, mi, mo; | ||
d = new Date((time > 10000000000 ? time : time * 1000)); | ||
mo = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'][d.getMonth()]; | ||
h = d.getHours(); | ||
am = h < 12 ? 'AM' : 'PM'; | ||
h = h === 0 ? 12 : h > 12 ? h - 12 : h; | ||
mi = (d.getMinutes() < 10 ? "0" : "") + d.getMinutes(); | ||
return "" + h + ":" + mi + " " + am + "<br>" + (d.getDate()) + " " + mo + " " + (d.getFullYear()); | ||
}; | ||
|
||
window.plugins.chart = { | ||
emit: function(div, item) { | ||
var captionElement, chartElement; | ||
chartElement = $('<p />').addClass('readout').appendTo(div).text(item.data.last().last()); | ||
return captionElement = $('<p />').html(wiki.resolveLinks(item.caption)).appendTo(div); | ||
}, | ||
bind: function(div, item) { | ||
return div.find('p:first').mousemove(function(e) { | ||
var sample, time, _ref; | ||
_ref = item.data[Math.floor(item.data.length * e.offsetX / e.target.offsetWidth)], time = _ref[0], sample = _ref[1]; | ||
$(e.target).text(sample.toFixed(1)); | ||
return $(e.target).siblings("p").last().html(formatTime(time)); | ||
}).dblclick(function() { | ||
return wiki.dialog("JSON for " + item.caption, $('<pre/>').text(JSON.stringify(item.data, null, 2))); | ||
}); | ||
} | ||
}; | ||
|
||
}).call(this); |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters