app/assets/javascripts/pghero/application.js in pghero-3.2.0 vs app/assets/javascripts/pghero/application.js in pghero-3.3.0
- old
+ new
@@ -1,14 +1,15 @@
//= require ./jquery
//= require ./nouislider
//= require ./Chart.bundle
//= require ./chartkick
-//= require ./highlight.pack
+//= require ./highlight.min
function highlightQueries() {
- $("pre code").each(function(i, block) {
- hljs.highlightBlock(block);
+ $("pre code").each(function (i, block) {
+ $(block).addClass("language-pgsql");
+ hljs.highlightElement(block);
});
}
function initSlider() {
function roundTime(time) {
@@ -43,13 +44,13 @@
connect: true,
start: [min, max]
});
// remove outline for mouse only
- $(".noUi-handle").mousedown(function() {
+ $(".noUi-handle").mousedown(function () {
$(this).addClass("no-outline");
- }).blur(function() {
+ }).blur(function () {
$(this).removeClass("no-outline");
});
function updateText() {
var values = slider.noUiSlider.get();
@@ -59,27 +60,27 @@
function setText(selector, offset) {
var time = timeAt(offset);
var html = "";
- if (time == now) {
- if (selector == "#range-end") {
+ if (time === now) {
+ if (selector === "#range-end") {
html = "Now";
}
} else {
html = time.getDate() + " " + months[time.getMonth()] + " " + pad(time.getHours()) + ":" + pad(time.getMinutes());
}
- $(selector).html(html);
+ $(selector).text(html);
}
function timeAt(offset) {
var time = new Date(sliderStartAt + (offset * 5) * 60 * 1000);
return (time > now) ? now : time;
}
function timeParam(time) {
- return time.toISOString();
+ return time.toISOString().replace(/\.000Z$/, "Z");
}
function queriesPath(params) {
var path = "queries";
if (params.start_at || params.end_at || params.sort || params.min_average_time || params.min_calls || params.debug) {
@@ -113,11 +114,11 @@
params.debug = debug;
}
var path = queriesPath(params);
- $(".queries-table th a").each( function () {
+ $(".queries-table th a").each(function () {
var p = $.extend({}, params, {sort: $(this).data("sort"), min_average_time: minAverageTime, min_calls: minCalls, debug: debug});
if (!p.sort) {
delete p.sort;
}
if (!p.min_average_time) {
@@ -133,11 +134,11 @@
});
var callback = function (response, status, xhr) {
if (status === "error" ) {
- $(".queries-info").css("color", "red").html(xhr.status + " " + xhr.statusText);
+ $(".queries-info").css("color", "red").text(xhr.status + " " + xhr.statusText);
} else {
highlightQueries();
}
};
$("#queries").html('<tr><td colspan="3"><p class="queries-info text-muted">...</p></td></tr>').load(path, callback);
@@ -150,9 +151,9 @@
slider.noUiSlider.on("slide", updateText);
slider.noUiSlider.on("change", function () {
refreshStats(true);
});
updateText();
- $( function () {
+ $(function () {
refreshStats(false);
});
}