Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

110
LINES

< > BotCompany Repo | #2000599 // outfront.js - show js console on mobile browser [fixed]

New Tinybrain snippet

let consoleLog = console.log
let consoleError = console.error
let consoleWarn = console.warn

const containerStyles = {
  position: 'fixed',
  overflow: 'scroll',
  width: '300px',
  height: '450px',
  display: 'none',
  bottom: '85px',
  zIndex: 100000,
  wordWrap: 'break-word',
  overflowWrap: 'break-word',
  right: '20px',
  marginLeft: '15px',
  backgroundColor: '#fff',
  borderRadius: '8px',
  boxShadow: '2px 4px 5px 3px rgba(224, 224, 224, 0.8)'
}

const floatButtonStyles = {
  opacity: 0.8,
  position: 'fixed',
  width: '70px',
  border: 'none',
  height: '35px',
  bottom: '40px',
  zIndex: 100000,
  right: '15px',
  backgroundColor: '#d4ebf2',
  color: '#fff',
  borderRadius: '50px',
  textAlign: 'center',
  cursor: 'pointer'
}

const buttonDefaultOpacity = {
  opacity: 1
}

const listItemStyles = {
  fontFamily: 'Arial',
  fontSize: '13px',
  paddingTop: '5px',
  paddingBottom: '5px',
  paddingLeft: '15px',
  paddingRight: '15px'
}

const clearBtnStyles = {
  cursor: 'pointer',
  float: 'right',
  paddingRight: '10px',
  paddingTop: '3px',
  opacity: 0.5,
  fontSize: '15px',
  backgroundColor: 'transparent',
  border: 'none'
}

const logoTextStyles = {
  fontFamily: 'Arial',
  fontSize: '16px',
  fontWeight: 'bold',
  paddingLeft: '15px',
  paddingTop: '3px',
  fontStyle: 'italic',
  color: '#525EF9'
}

const notificationBadgeStyles = {
  position: 'absolute',
  display: 'none',
  top: '-3px',
  right: '6px',
  width: '12px',
  height: '12px',
  borderRadius: '50%',
  backgroundColor: 'red'
}

let outfrontLogUl = document.createElement('UL') // Memory leak alert
const notificationBadge = document.createElement('SPAN') // Memory leak alert

const createButtonAndContainer = () => {
  try {
    // Create container start
    const container = document.createElement('DIV')
    container.id = 'outfront-container'
    for (let property in containerStyles) {
      container.style[property] = containerStyles[property]
    }
    // Create container end

    // Create clear console button start
    const clearBtn = document.createElement('BUTTON') // button
    clearBtn.id = 'outfront-clear-btn'
    clearBtn.innerText = String.fromCharCode(55357, 56350) // bug symbol
    for (let property in clearBtnStyles) {
      clearBtn.style[property] = clearBtnStyles[property]
    }
    clearBtn.addEventListener('click', () => (outfrontLogUl.innerHTML = ''))
    container.appendChild(clearBtn)
    // Create clear console button end

    //Create logo text start
    let logo = document.createElement('DIV')
    logo.id = 'outfront-container'
    logo.innerText = '

Author comment

Began life as a copy of #2000598

download  show line numbers   

Snippet is not live.

Travelled to 3 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx

No comments. add comment

Snippet ID: #2000599
Snippet name: outfront.js - show js console on mobile browser [fixed]
Eternal ID of this version: #2000599/1
Text MD5: f89ae3742f88fcb4203e88f6ab251786
Author: stefan
Category: js
Type: New Tinybrain snippet
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-08-26 16:58:39
Source code size: 2704 bytes / 110 lines
Pitched / IR pitched: No / No
Views / Downloads: 133 / 55
Referenced in: [show references]