var option = localStorage.getItem('nogg');
var nogg = document.getElementById('nogg');

function toggleNoGG() {
  console.log(option);
  if (option === 'on') {
    nogg.style.color = '';
    option = 'off';
    localStorage.setItem('nogg', 'off');
  } else {
    nogg.style.color = 'green';
    option = 'on';
    localStorage.setItem('nogg', 'on');
  }
}

window.addEventListener('load', () => {
	if (localStorage.getItem('nogg') === 'on')
		nogg.style.color = 'green';

	function isUrl(val = '') {
		if (/^http(s?):\/\//.test(val) || val.includes('.') && val.substr(0, 1) !== ' ') return true;
		return false;
	};

	// NOGG
	const useNoGG = false;
	const form = document.querySelector('form');
	form.addEventListener('submit', event => {
		event.preventDefault();

    if (typeof navigator.serviceWorker === 'undefined')
      alert('Your browser does not support service workers or you are in private browsing!');

		navigator.serviceWorker.register('./sw.js', {
			scope: __uv$config.prefix
		}).then(() => {
			const value = event.target.firstElementChild.value;

			let url = value.trim();
			if (!isUrl(url))
				url = 'https://search.brave.com/search?q=' + url;
			else
			if (!(url.startsWith('https://') || url.startsWith('http://'))) url = 'http://' + url;
			const redirectTo = __uv$config.prefix + __uv$config.encodeUrl(url);
			const option = localStorage.getItem('nogg');
			if (option === 'on') {

				const nogg = window.open("about:blank", '_blank', "popup");

				setTimeout(() => {
					nogg.document.write(`
								<!DOCTYPE html>
								<style>
                body {
                  margin: 0;
                }
                iframe {
                  display: block;
                  border: none;
                  height: 100vh;
                  width: 100vw;
                }
.custom_menu {
    width: 100%;
    margin: 0 auto;
    text-align: center;
}
.custom_menu ul {
    margin: 0px;
    padding: 0px;
    display: inline-block;
}
.custom_menu li {
    float: left;
    font-size: 16px;
    color: #f1f1f1;
    padding-left: 100px;
    padding-right: 100px;
}
 ul, li, ol {
    margin: 0px;
    padding: 0px;
    list-style: none;
    color: white;
} 
ul {
    display: block;
    list-style-type: disc;
    margin-block-start: 1em;
    margin-block-end: 1em;
    margin-inline-start: 0px;
    margin-inline-end: 0px;
    padding-inline-start: 40px;
    
}
li {
   color: white;
  font-family: "Helvetica";
  /* background-color: #210535; */
  padding: 10px;
  border-radius: 10px;
  text-decoration: none;
  transition: 0.5s;
}
a {
  color: white;
  font-family: "Helvetica";
  /* background-color: #210535; */
  padding: 10px;
  border-radius: 10px;
  text-decoration: none;
  transition: 0.5s;
}
a:hover {
  color: grey;
  transition: 0.5s;
  cursor: pointer;
}
.header_section_top {
  position: fixed;
    animation-name: fadein;
    animation-duration: 2s;
    width: 100%;
    float: left;
    background-color: rgb(90, 24, 154);
    clip-path: polygon(0 0, 100% 0, 96% 100%, 3% 100%);
    height: auto;
   padding: -25px 0px;
    color: white;
}
                </style>
                <head>
<title> Google Classroom </title> 
<link rel="icon" type="image/x-icon" href="data:image/jpeg;base64,[encoded data, 7200 characters]">
                      </head> 
                        <body> 
 
								<iframe sandbox=" allow-downloads allow-forms allow-modals allow-orientation-lock allow-pointer-lock allow-presentation allow-scripts allow-same-origin allow-popups" src=${redirectTo}>
</iframe>
      
</body> 
            `);
				}, 500);
			} else location.href = redirectTo;
		});
	});
});

function hide() {
	var x = document.getElementById("banner_bg_main");
	if (x.style.display === "none") {
		x.style.display = "block";
	} else {
		x.style.display = "none";
	}
}