清除rails更好的错误控制台

时间:2015-07-07 09:48:35

标签: ruby-on-rails better-errors-gem

如何清除rails web控制台?

更好的错误网页控制台的图片链接

enter image description here

1 个答案:

答案 0 :(得分:0)

我开发了一些JavaScript,可以将其推入书签中,并在浏览器中用于清除实时控制台。

详细代码

var consoleElements = document.querySelectorAll('.console');
var arrayLength = consoleElements.length;
if(arrayLength<1){
  console.log("No consoles found to clear.");
} else {
  for (var i = 0; i < arrayLength; i++) {
    var consoleElement = consoleElements[i];
    var consoleHistoryElement = consoleElement.querySelector('pre');
    consoleHistoryElement.innerHTML = "";
    consoleHistoryElement.style.backgroundColor = "#FF906F";
    setTimeout(function() {
      consoleHistoryElement.style.transition = "background-color 1.5s";
      consoleHistoryElement.style.backgroundColor = "";
      setTimeout(function() {
        consoleHistoryElement.style.transition = "";
      }, 1500);
    }, 0);
  }
  console.log(arrayLength + " consoles cleared.");
}

小书签

javascript:var consoleElements=document.querySelectorAll('.console');var arrayLength=consoleElements.length;if(arrayLength<1){console.log("No consoles found to clear.");}else{for(var i=0;i<arrayLength;i++){var consoleElement=consoleElements[i];var consoleHistoryElement=consoleElement.querySelector('pre');consoleHistoryElement.innerHTML="";consoleHistoryElement.style.backgroundColor="#FF906F";setTimeout(function(){consoleHistoryElement.style.transition="background-color 1.5s";consoleHistoryElement.style.backgroundColor="";setTimeout(function() {consoleHistoryElement.style.transition = "";},1500);},0);}console.log(arrayLength + " consoles cleared.");}