JAVASCRIPT   34
display
Guest on 26th May 2023 12:56:10 PM


  1. function isInAContentEditableElement(element) {
  2.         if (element == null) {
  3.                 return false;
  4.         }
  5.        
  6.         if (element.contentEditable && element.contentEditable !== 'inherit') {
  7.                 return true;
  8.         }
  9.        
  10.         return isInAContentEditableElement(element.parentNode);
  11. }
  12.  
  13. function displayFunction() {   
  14.         var images = document.getElementsByTagName('img');
  15.        
  16.         for (var i = images.length - 1; i >= 0; --i) {
  17.                 if (images[i].className == 'Wirisformula' && !isInAContentEditableElement(images[i])) {
  18.                         images[i].align = '';
  19.                         images[i].style.verticalAlign = (-images[i].height / 2) + 'px';
  20.                 }
  21.         }
  22. }
  23.  
  24. if (window.addEventListener && navigator.userAgent.indexOf("Trident") > 0) { // I.E 11
  25.         window.addEventListener('load', displayFunction, false);
  26. } else if (window.attachEvent) {
  27.         window.attachEvent('onload', displayFunction);
  28. }

Raw Paste

Login or Register to edit or fork this paste. It's free.