Clear rails

How to clean rails web console?

Link to the best web console errors

enter image description here

+4
source share
1 answer

I developed some JavaScript that you can put in the bookmarklet and use it in the browser to clear the live console.

Detailed code

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.");
}

Bookmarklet

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.");}
0
source

All Articles