Skip to content

Commit

Permalink
Update mcr.html
Browse files Browse the repository at this point in the history
  • Loading branch information
ITron-Legends authored Oct 10, 2024
1 parent f83d4b3 commit fc7df8c
Showing 1 changed file with 6 additions and 92 deletions.
98 changes: 6 additions & 92 deletions mcr.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,103 +2,17 @@
<html>
<head>
<title>Open Edge Button</title>
<style>
body {
background-color: #222222;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
}

#rewardImage {
max-width: 200px;
margin-bottom: 20px;
}

#title {
color: #ffffff;
font-size: 24px;
font-weight: bold;
margin-bottom: 20px;
}

#loginButton,
#searchButton {
background-color: #007bff;
color: #ffffff;
border-radius: 10px;
padding: 10px 20px;
font-size: 16px;
border: none;
margin-bottom: 20px;
}

#codeBlock {
background-color: rgba(0, 0, 0, 0.7);
color: #ffffff;
padding: 20px;
font-family: monospace;
font-size: 14px;
white-space: pre-wrap;
overflow-x: auto;
width: 80%;
max-height: 200px;
border-radius: 10px;
}
</style>
<!-- Importing CSS from the css subfolder -->
<link rel="stylesheet" href="mcr/styles.css">
</head>
<body>
<h1 id="title">Random Question Generator for Microsoft Rewards</h1>
<h1 id="title">Random Word Generator for Microsoft Rewards</h1>
<img id="rewardImage" src="https://az15297.vo.msecnd.net/images/rewards/membercenter/missions/Ms_Logo_48px.png" alt="Microsoft Rewards">
<button id="loginButton" onclick="redirectToLoginPage()">Login to Microsoft</button>
<div id="codeBlock"></div>
<button id="searchButton" onclick="searchRandomQuestionAndOpenEdge()">Generate Question for Rewards</button>

<script>
function redirectToLoginPage() {
window.location.href = "https://login.microsoft.com";
}

function searchRandomQuestionAndOpenEdge() {
fetch('https://opentdb.com/api.php?amount=1')
.then(response => response.json())
.then(data => {
let question = data.results[0].question;
question = decodeHtmlEntities(question);
displayQuestion(question);
openEdgeAndSearch(question);
setTimeout(goBackToButton, 1000); // Adjusted the delay to 1 second (1000 milliseconds)
})
.catch(error => {
console.error('Error:', error);
});
}

function decodeHtmlEntities(text) {
const textArea = document.createElement('textarea');
textArea.innerHTML = text;
return textArea.value;
}

function displayQuestion(question) {
const codeBlock = document.getElementById('codeBlock');
codeBlock.textContent = question;
}

function openEdgeAndSearch(question) {
var searchQuery = encodeURIComponent(question);
var searchUrl = "https://www.bing.com/search?q=" + searchQuery;

window.open(searchUrl, "_blank");
}

function goBackToButton() {
document.getElementById('searchButton').scrollIntoView();
}
<button id="searchButton" onclick="searchRandomWordAndOpenEdge()">Generate Word for Rewards</button>

</script>
<!-- Importing JS from the js subfolder -->
<script src="mcr/scripts.js"></script>
</body>
</html>

0 comments on commit fc7df8c

Please sign in to comment.