Skip to content

Commit

Permalink
Merge pull request reisxd#538 from git-Hmmm/main
Browse files Browse the repository at this point in the history
Introducing Automatically proceed to next page and a Settings page!
  • Loading branch information
reis authored Nov 4, 2022
2 parents e9921c9 + 01f8277 commit a32571f
Show file tree
Hide file tree
Showing 17 changed files with 207 additions and 260 deletions.
18 changes: 2 additions & 16 deletions public/about/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,23 +78,9 @@ <h4>
></i>
<div style="margin-left: 10px"></div>
<i
class="social-icon fa-xl fa-solid fa-palette"
onclick="openColorPicker();"
class="social-icon fa-xl fa-solid fa-gear"
onclick="openSettings();"
></i>
<div class="theming">
<div id="themecolor-picker">
<span style="background: #4873b3 none repeat scroll 0% 0%"></span>
<span style="background: #df0000bf none repeat scroll 0% 0%"></span>
<span style="background: #605dbbb3 none repeat scroll 0% 0%"></span>
<span style="background: #00e60069 none repeat scroll 0% 0%"></span>
<span style="background: #0067fdc7 none repeat scroll 0% 0%"></span>
<span
onclick="this.style.setProperty('background-color', prompt('Set Custom Color (eg. #000 or yellow or anything that works with css)', document.documentElement.style.getPropertyValue('--accentColor')));"
style="background: var(--accentColor) none repeat scroll 0% 0%"
>🎨</span
>
</div>
</div>
<span class="right"></span>
<button onclick="history.back()">Back</button>
</footer>
Expand Down
18 changes: 2 additions & 16 deletions public/apps/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -82,23 +82,9 @@ <h1>Select the app you want to patch</h1>
></i>
<div style="margin-left: 10px"></div>
<i
class="social-icon fa-xl fa-solid fa-palette"
onclick="openColorPicker();"
class="social-icon fa-xl fa-solid fa-gear"
onclick="openSettings();"
></i>
<div class="theming">
<div id="themecolor-picker">
<span style="background: #4873b3 none repeat scroll 0% 0%"></span>
<span style="background: #df0000bf none repeat scroll 0% 0%"></span>
<span style="background: #605dbbb3 none repeat scroll 0% 0%"></span>
<span style="background: #00e60069 none repeat scroll 0% 0%"></span>
<span style="background: #0067fdc7 none repeat scroll 0% 0%"></span>
<span
onclick="this.style.setProperty('background-color', prompt('Set Custom Color (eg. #000 or yellow or anything that works with css)', document.documentElement.style.getPropertyValue('--accentColor')));"
style="background: var(--accentColor) none repeat scroll 0% 0%"
>🎨</span
>
</div>
</div>
<span class="right"></span>
<button class="highlighted" id="continue" onclick="setApp()">
Continue
Expand Down
19 changes: 0 additions & 19 deletions public/colors.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,2 @@
const accentColors = document.querySelectorAll('.theming span');

const colorNow = localStorage.getItem('theme') ?? '#4873b3';
document.documentElement.style.setProperty('--accentColor', colorNow);

/* eslint-disable no-unused-vars */
function openColorPicker() {
document.querySelector('.theming').classList.toggle('show');
}

accentColors.forEach((color) => {
color.addEventListener('click', () => {
accentColors.forEach((el) => el.classList.remove('active'));
color.classList.add('active');

const colorNow1 = color.style.getPropertyValue('background-color');

document.documentElement.style.setProperty('--accentColor', colorNow1);
localStorage.setItem('theme', colorNow1);
});
});
18 changes: 2 additions & 16 deletions public/dependencies/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,9 @@ <h1>Downloading dependencies</h1>
></i>
<div style="margin-left: 10px"></div>
<i
class="social-icon fa-xl fa-solid fa-palette"
onclick="openColorPicker();"
class="social-icon fa-xl fa-solid fa-gear"
onclick="openSettings();"
></i>
<div class="theming">
<div id="themecolor-picker">
<span style="background: #4873b3 none repeat scroll 0% 0%"></span>
<span style="background: #df0000bf none repeat scroll 0% 0%"></span>
<span style="background: #605dbbb3 none repeat scroll 0% 0%"></span>
<span style="background: #00e60069 none repeat scroll 0% 0%"></span>
<span style="background: #0067fdc7 none repeat scroll 0% 0%"></span>
<span
onclick="this.style.setProperty('background-color', prompt('Set Custom Color (eg. #000 or yellow or anything that works with css)', document.documentElement.style.getPropertyValue('--accentColor')));"
style="background: var(--accentColor) none repeat scroll 0% 0%"
>🎨</span
>
</div>
</div>
<span class="right"></span>
<button onclick="location.href='../index.html'">Back</button>
<button
Expand Down
18 changes: 2 additions & 16 deletions public/devices/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,9 @@ <h1>Select the device(s) you want to install ReVanced to</h1>
></i>
<div style="margin-left: 10px"></div>
<i
class="social-icon fa-xl fa-solid fa-palette"
onclick="openColorPicker();"
class="social-icon fa-xl fa-solid fa-gear"
onclick="openSettings();"
></i>
<div class="theming">
<div id="themecolor-picker">
<span style="background: #4873b3 none repeat scroll 0% 0%"></span>
<span style="background: #df0000bf none repeat scroll 0% 0%"></span>
<span style="background: #605dbbb3 none repeat scroll 0% 0%"></span>
<span style="background: #00e60069 none repeat scroll 0% 0%"></span>
<span style="background: #0067fdc7 none repeat scroll 0% 0%"></span>
<span
onclick="this.style.setProperty('background-color', prompt('Set Custom Color (eg. #000 or yellow or anything that works with css)', document.documentElement.style.getPropertyValue('--accentColor')));"
style="background: var(--accentColor) none repeat scroll 0% 0%"
>🎨</span
>
</div>
</div>
<span class="right"></span>
<button id="back" onclick="history.back()">Back</button>
<button class="highlighted" id="continue" onclick="setDevice()">
Expand Down
18 changes: 2 additions & 16 deletions public/failure/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,9 @@ <h1>Failure</h1>
></i>
<div style="margin-left: 10px"></div>
<i
class="social-icon fa-xl fa-solid fa-palette"
onclick="openColorPicker();"
class="social-icon fa-xl fa-solid fa-gear"
onclick="openSettings();"
></i>
<div class="theming">
<div id="themecolor-picker">
<span style="background: #4873b3 none repeat scroll 0% 0%"></span>
<span style="background: #df0000bf none repeat scroll 0% 0%"></span>
<span style="background: #605dbbb3 none repeat scroll 0% 0%"></span>
<span style="background: #00e60069 none repeat scroll 0% 0%"></span>
<span style="background: #0067fdc7 none repeat scroll 0% 0%"></span>
<span
onclick="this.style.setProperty('background-color', prompt('Set Custom Color (eg. #000 or yellow or anything that works with css)', document.documentElement.style.getPropertyValue('--accentColor')));"
style="background: var(--accentColor) none repeat scroll 0% 0%"
>🎨</span
>
</div>
</div>
<span class="right"></span>
<button onclick="history.back();">Back</button>
<button onclick="exitApp();">Exit</button>
Expand Down
30 changes: 2 additions & 28 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,35 +70,9 @@ <h2>Status</h2>
></i>
<div style="margin-left: 10px"></div>
<i
class="social-icon fa-xl fa-solid fa-palette"
onclick="openColorPicker();"
class="social-icon fa-xl fa-solid fa-gear"
onclick="openSettings();"
></i>
<div class="theming">
<div id="themecolor-picker">
<span
style="background: #4873b3 none repeat scroll 0% 0%"
></span>
<span
style="background: #df0000bf none repeat scroll 0% 0%"
></span>
<span
style="background: #605dbbb3 none repeat scroll 0% 0%"
></span>
<span
style="background: #00e60069 none repeat scroll 0% 0%"
></span>
<span
style="background: #0067fdc7 none repeat scroll 0% 0%"
></span>
<span
onclick="this.style.setProperty('background-color', prompt('Set Custom Color (eg. #000 or yellow or anything that works with css)', document.documentElement.style.getPropertyValue('--accentColor')));"
style="
background: var(--accentColor) none repeat scroll 0% 0%;
"
>🎨</span
>
</div>
</div>
</div>
</div>
</div>
Expand Down
28 changes: 21 additions & 7 deletions public/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,10 @@ function openGitHub() {
window.open('https://github.com/reisxd/revanced-builder', '_blank');
}

function openSettings() {
location.href = '/settings';
}

/**
* @param {string} phrase
*/
Expand Down Expand Up @@ -273,19 +277,26 @@ ws.onmessage = (msg) => {
</li>`;
}
document.getElementById('search').addEventListener('keyup', () => {
const searchText = document.getElementById('search').value.toLowerCase();
const searchText = document
.getElementById('search')
.value.toLowerCase();

Array.from(document.getElementsByTagName('li'))
.forEach(x => x.style.display = "none");
Array.from(document.getElementsByTagName('li')).forEach(
(x) => (x.style.display = 'none')
);

Array.from(document.getElementsByClassName('patchName'))
.filter(x => x.innerText.toLowerCase().includes(searchText))
.forEach(x => x.parentNode.parentNode.style.display = "flex");
.filter((x) => x.innerText.toLowerCase().includes(searchText))
.forEach((x) => (x.parentNode.parentNode.style.display = 'flex'));
});

Array.from(document.getElementsByClassName('select'))
.filter(patch => message.rememberedPatchList.includes(patch.getAttribute('data-patch-name')))
.forEach(patch => patch.checked = true);
.filter((patch) =>
message.rememberedPatchList.includes(
patch.getAttribute('data-patch-name')
)
)
.forEach((patch) => (patch.checked = true));
}
break;
case 'downloadingFile':
Expand Down Expand Up @@ -318,6 +329,9 @@ ws.onmessage = (msg) => {
hasFinished = true;

document.getElementById('continue').classList.remove('disabled');
if (localStorage.getItem('auto-next')) {
document.getElementById('continue').click();
}
document.getElementsByClassName('log')[0].innerHTML +=
'<span class="log-line"><strong>[builder]</strong> Finished downloading files.</span><br/>';
break;
Expand Down
18 changes: 2 additions & 16 deletions public/installer/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,9 @@ <h1>Installing...</h1>
></i>
<div style="margin-left: 10px"></div>
<i
class="social-icon fa-xl fa-solid fa-palette"
onclick="openColorPicker();"
class="social-icon fa-xl fa-solid fa-gear"
onclick="openSettings();"
></i>
<div class="theming">
<div id="themecolor-picker">
<span style="background: #4873b3 none repeat scroll 0% 0%"></span>
<span style="background: #df0000bf none repeat scroll 0% 0%"></span>
<span style="background: #605dbbb3 none repeat scroll 0% 0%"></span>
<span style="background: #00e60069 none repeat scroll 0% 0%"></span>
<span style="background: #0067fdc7 none repeat scroll 0% 0%"></span>
<span
onclick="this.style.setProperty('background-color', prompt('Set Custom Color (eg. #000 or yellow or anything that works with css)', document.documentElement.style.getPropertyValue('--accentColor')));"
style="background: var(--accentColor) none repeat scroll 0% 0%"
>🎨</span
>
</div>
</div>
<span class="right"></span>
</footer>
</div>
Expand Down
18 changes: 2 additions & 16 deletions public/patch/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,9 @@ <h1>Patching...</h1>
></i>
<div style="margin-left: 10px"></div>
<i
class="social-icon fa-xl fa-solid fa-palette"
onclick="openColorPicker();"
class="social-icon fa-xl fa-solid fa-gear"
onclick="window.open('/settings', '_blank');"
></i>
<div class="theming">
<div id="themecolor-picker">
<span style="background: #4873b3 none repeat scroll 0% 0%"></span>
<span style="background: #df0000bf none repeat scroll 0% 0%"></span>
<span style="background: #605dbbb3 none repeat scroll 0% 0%"></span>
<span style="background: #00e60069 none repeat scroll 0% 0%"></span>
<span style="background: #0067fdc7 none repeat scroll 0% 0%"></span>
<span
onclick="this.style.setProperty('background-color', prompt('Set Custom Color (eg. #000 or yellow or anything that works with css)', document.documentElement.style.getPropertyValue('--accentColor')));"
style="background: var(--accentColor) none repeat scroll 0% 0%"
>🎨</span
>
</div>
</div>
<span class="right"></span>
</footer>
</div>
Expand Down
18 changes: 2 additions & 16 deletions public/patches/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,23 +48,9 @@ <h1>Select patches to include</h1>
></i>
<div style="margin-left: 10px"></div>
<i
class="social-icon fa-xl fa-solid fa-palette"
onclick="openColorPicker();"
class="social-icon fa-xl fa-solid fa-gear"
onclick="openSettings();"
></i>
<div class="theming">
<div id="themecolor-picker">
<span style="background: #4873b3 none repeat scroll 0% 0%"></span>
<span style="background: #df0000bf none repeat scroll 0% 0%"></span>
<span style="background: #605dbbb3 none repeat scroll 0% 0%"></span>
<span style="background: #00e60069 none repeat scroll 0% 0%"></span>
<span style="background: #0067fdc7 none repeat scroll 0% 0%"></span>
<span
onclick="this.style.setProperty('background-color', prompt('Set Custom Color (eg. #000 or yellow or anything that works with css)', document.documentElement.style.getPropertyValue('--accentColor')));"
style="background: var(--accentColor) none repeat scroll 0% 0%"
>🎨</span
>
</div>
</div>
<span class="right"></span>
<button onclick="history.back()">Back</button>
<button class="highlighted" id="continue" onclick="setPatches();">
Expand Down
31 changes: 31 additions & 0 deletions public/settings.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
const accentColors = document.querySelectorAll('#themecolor-picker span');
const enbtn = document.querySelector('#enable');
const dbbtn = document.querySelector('#disable');

accentColors.forEach((color) => {
color.addEventListener('click', () => {
accentColors.forEach((el) => el.classList.remove('active'));
color.classList.add('active');

const colorNow1 = color.style.getPropertyValue('background-color');

document.documentElement.style.setProperty('--accentColor', colorNow1);
localStorage.setItem('theme', colorNow1);
});
});

if (localStorage.getItem('auto-next')) {
enbtn.style.display = 'none';
} else {
dbbtn.style.display = 'none';
}
enbtn.addEventListener('click', function () {
enbtn.style.display = 'none';
dbbtn.style.display = 'block';
localStorage.setItem('auto-next', true);
});
dbbtn.addEventListener('click', function () {
dbbtn.style.display = 'none';
enbtn.style.display = 'block';
localStorage.removeItem('auto-next');
});
Loading

0 comments on commit a32571f

Please sign in to comment.