Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
1.1 kB
4
Indexable
Never
const cornerButton = document.createElement('button');
cornerButton.textContent = 'w';
cornerButton.className = 'fixed-corner-button';
document.body.appendChild(cornerButton);

cornerButton.addEventListener('click', () => {
	if (cornerButton.classList.contains('active')) {
		enableFunctions('987px');
		cornerButton.classList.remove('active');
	} else {
		enableFunctions('10987px');
		cornerButton.classList.add('active');
	}
});

function enableFunctions(toWidth) {
	const iframe = document.querySelector(
		'#rootArea > div:nth-child(3) > div.content > div.main > iframe'
	);
	const iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
	const element = iframeDoc.getElementById(
		'ctl00_MainContent_ctl00_searchDirectorUC_gridView'
	);
	element.style.width = toWidth;
}



.fixed-corner-button {
  position: fixed;
  bottom: 0;
  left: 0;
  z-index: 1000;
  padding: 5px 10px;
  border: none;
  border-radius: 50%;
  background-color: #333;
  color: #fff;
  cursor: pointer;
}

.fixed-corner-button:hover {
  background-color: #444;
}

.fixed-corner-button.active {
  background-color: #666;
}
Leave a Comment