src/content.js
/**
 * Generates the content for the top pane.
 * @param {String} text - String with HTML code in raw text
 */
Generates the content for the top pane.
@param {String} text - String with HTML code in raw text
Generates the content for the top pane . @param { String } text - String with HTML code in raw text
function makeTopPane (text) {
  const newDiv = document.createElement('div')
  newDiv.style = 'all:initial'
  newDiv.innerHTML =
    '<div id="aso12909" style="width:100%;padding-right:10px;padding-left:10px;background-color:rgba(244,230,155,0.8);position: fixed;box-shadow: 0 2px 6px #3C4A54;z-index:9999999;left:0;top:0;">\n' +
    '<font style="font-size:20px;font-family:Arial;">' +
    '<img src="' + chrome.runtime.getURL('icon48.png') + '" alt="" style="margin-left:0px; margin-top:0px; margin-right:4px; width:28px; height:28px; vertical-align:sub;display:inline-block" />' +
    text + '<button id="aso12910" style="font-size:20px;font-family:verdana;height: 28px;float: right;margin-right: 12px;border: none;background: none;cursor: pointer;" title="Skjul rabat">X</button>' +
    '</font>\n' +
    '</div>\n'
  const shadowDiv = document.createElement('div')
  document.body.insertBefore(shadowDiv, document.body.firstChild)
  const shadow = shadowDiv.attachShadow({ mode: 'open' })
  shadow.appendChild(newDiv)
  const elem = shadow.getElementById('aso12910')
  elem.addEventListener('click', function () {
    elem.parentNode.parentNode.parentNode.remove()
    chrome.storage.local.set({ rabat_closed: tabDomainName }, function () {
      console.log('Content: Close button domain name: ' + tabDomainName)
    })
  })
}
function makeTopPane ( text ) { const newDiv = document . createElement ( 'div' ) newDiv . style = 'all:initial' newDiv . innerHTML = '<div id="aso12909" style="width:100%;padding-right:10px;padding-left:10px;background-color:rgba(244,230,155,0.8);position: fixed;box-shadow: 0 2px 6px #3C4A54;z-index:9999999;left:0;top:0;">\n' + '<font style="font-size:20px;font-family:Arial;">' + '<img src="' + chrome . runtime . getURL ( 'icon48.png' ) + '" alt="" style="margin-left:0px; margin-top:0px; margin-right:4px; width:28px; height:28px; vertical-align:sub;display:inline-block" />' + text + '<button id="aso12910" style="font-size:20px;font-family:verdana;height: 28px;float: right;margin-right: 12px;border: none;background: none;cursor: pointer;" title="Skjul rabat">X</button>' + '</font>\n' + '</div>\n' const shadowDiv = document . createElement ( 'div' ) document . body . insertBefore ( shadowDiv , document . body . firstChild ) const shadow = shadowDiv . attachShadow ( { mode : 'open' } ) shadow . appendChild ( newDiv ) const elem = shadow . getElementById ( 'aso12910' ) elem . addEventListener ( 'click' , function ( ) { elem . parentNode . parentNode . parentNode . remove ( ) chrome . storage . local . set ( { rabat_closed : tabDomainName } , function ( ) { console . log ( 'Content: Close button domain name: ' + tabDomainName ) } ) } ) }
Generates the content for the top pane.
Generates the content for the top pane .
// Append div as the first child of body
 // Make close button function
