Skip to content

Close Salesforce tabs with arc boost #90

@SamEdwardes

Description

@SamEdwardes
document.addEventListener('DOMContentLoaded', function() {
  // Create a button element
  const button = document.createElement('button');
  button.innerHTML = `
    <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="#FACDD7" viewBox="0 0 256 256">
      <path d="M165.66,101.66,139.31,128l26.35,26.34a8,8,0,0,1-11.32,11.32L128,139.31l-26.34,26.35a8,8,0,0,1-11.32-11.32L116.69,128,90.34,101.66a8,8,0,0,1,11.32-11.32L128,116.69l26.34-26.35a8,8,0,0,1,11.32,11.32ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z"></path>
    </svg>
    <span style="margin-left: 2px;">Tabs</span>
  `;

  // Style the button
  button.style.position = 'fixed';
  button.style.bottom = '20px';
  button.style.right = '20px';
  button.style.padding = '10px 10px';
  button.style.backgroundColor = '#A30D30';
  button.style.color = '#FACDD7';
  button.style.border = 'none';
  button.style.borderRadius = '5px';
  button.style.cursor = 'pointer';
  button.style.zIndex = '9999';
  button.style.display = 'flex';
  button.style.alignItems = 'center';      // Center items vertically
  button.style.justifyContent = 'center';  // Center items horizontally

  // Add hover effect
  button.addEventListener('mouseover', function() {
    this.style.backgroundColor = '#B56327';
  });
  button.addEventListener('mouseout', function() {
    this.style.backgroundColor = '#A30D30';
  });

  // Add the button to the document
  document.body.appendChild(button);

  // Add click event listener
  button.addEventListener('click', function() {
    console.log('Closing Salesforce tabs');
    const closeSalesforceTabs = new KeyboardEvent('keydown', {
      key: 'w',
      code: 'KeyW',
      metaKey: false,  // 'cmd' key on Mac
      shiftKey: true,
      bubbles: true
    });
    document.dispatchEvent(closeSalesforceTabs);
  });
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions