Skip to content

Commit

Permalink
Merge branch 'experimental'
Browse files Browse the repository at this point in the history
  • Loading branch information
Elaina69 committed Jan 19, 2025
2 parents 6144bac + cac9708 commit 882f680
Show file tree
Hide file tree
Showing 21 changed files with 187 additions and 160 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
</p>

<p align="center">
<img src="https://count.getloli.com/@Elainav4?name=Elainav4&theme=gelbooru-h&padding=7&offset=0&align=center&scale=1&pixelated=1&darkmode=auto" alt="moe counter" />
<img src="https://count.getloli.com/@Elainav4?name=Elainav4&theme=gelbooru&padding=7&offset=0&align=center&scale=1&pixelated=1&darkmode=auto" alt="moe counter" />
<p align="center"> Visitors (Since 2023/02/01) </p>
<br>
<p align="center"> One of the best theme for Pengu Loader (League of Legends) </p>
Expand Down
6 changes: 1 addition & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* @link https://github.com/Elaina69
* @Nyan Meow~~~
*/
import "./src/utils/setTime.ts"
import { log } from './src/utils/themeLog.ts';

log('By %cElaina Da Catto', 'color: #e4c2b3');
Expand All @@ -18,7 +19,6 @@ import './src/services/backupAndRestoreDatastore';

// Import modules
import { Cdninit } from './src/theme/Cdninit.ts';
import { CheckServerAvailability } from './src/services/checkServer.ts';
import { CheckUpdate } from "./src/updates/checkUpdate.ts"
import { createHomePageTab, HomePage } from "./src/theme/homepage.ts";
import { transparentLobby, ApplyUI } from "./src/theme/applyUi.ts";
Expand Down Expand Up @@ -53,10 +53,6 @@ class ElainaTheme {
}

main() {
// Check theme server
const checkServerAvailability = new CheckServerAvailability()
checkServerAvailability.main()

// Check theme's version and available update
const checkUpdate = new CheckUpdate()
checkUpdate.main()
Expand Down
3 changes: 3 additions & 0 deletions src/src/assets/styles/components/sidebar-color.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.sidebar-background {
background: var(--social-sidebar-bg-color) !important;
}
3 changes: 3 additions & 0 deletions src/src/assets/styles/components/sidebar-transparent.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.sidebar-background {
background: transparent !important
}
4 changes: 4 additions & 0 deletions src/src/assets/styles/themes/elaina.css
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ html {
filter: var(--play-button-filter) !important;
}

.npe-header-league-logo {
filter: var(--play-button-filter) !important;
}

.stats-backdrop {
opacity: 0.3!important;
mix-blend-mode: difference !important;
Expand Down
8 changes: 8 additions & 0 deletions src/src/assets/styles/themes/rcp-fe-lol-parties.css
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,12 @@

.confirm-button-container {
filter: var(--find-match-button) !important;
}

.tft-find-match-button-container {
filter: var(--find-match-button) !important;
}

.parties-footer-notifications {
top: -120px !important;
}
1 change: 0 additions & 1 deletion src/src/assets/styles/themes/rcp-fe-viewport-sidebar.css
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ lol-social-roster-member .offline .member-name {
.sidebar-background {
height: 100%;
width: 222px;
background: var(--social-sidebar-bg-color) !important;
position: absolute;
transition: transform 0.5s ease;
transform: translateX(0px);
Expand Down
87 changes: 48 additions & 39 deletions src/src/plugins/autoAccept.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,26 @@ export class AutoAccept {
}
}

fetch_or_create_champselect_buttons_container(): Element | null {
if (document.querySelector(".cs-buttons-container")) {
return document.querySelector(".cs-buttons-container")
fetch_or_create_champselect_buttons_container(): any {
try {
document.querySelector(".cs-buttons-container")?.remove()
}
catch {}

const div = document.createElement("div")
div.className = "cs-buttons-container"

let nor: HTMLElement | null = document.querySelector(".v2-footer-notifications.ember-view")
let tft: HTMLElement | null = document.querySelector(".parties-footer-notifications.ember-view")

if (nor) {
nor.append(div)
return div
}
else if (tft) {
tft?.append(div)
return div
}
else {
const div = document.createElement("div")
div.className = "cs-buttons-container"

let nor: HTMLElement | null = document.querySelector(".v2-footer-notifications.ember-view")
let tft: HTMLElement | null = document.querySelector(".parties-footer-notifications.ember-view")

if (nor) {
nor.append(div)
return div
}
else {
tft?.append(div)
return div
}
}
}

acceptMatchmaking = async (): Promise<void> => {
Expand All @@ -55,30 +55,39 @@ export class AutoAccept {
}
}


createButton = async (element: any) => {
const newOption = document.createElement("lol-uikit-radio-input-option")
const container = this.fetch_or_create_champselect_buttons_container()
const Option2 = document.createElement("div")

newOption.setAttribute("id", "autoAcceptQueueButton")
newOption.setAttribute("onclick", "window.autoAcceptQueueButtonSelect()")

Option2.classList.add("auto-accept-button-text")
Option2.innerHTML = await getString("auto_accept")

if (window.DataStore.get("auto_accept")){
newOption.setAttribute("selected", "")
}

if (element && !document.getElementById("autoAcceptQueueButton")) {
if (window.DataStore.get("auto_accept_button")) {
container?.append(newOption)
newOption.append(Option2)
}
}
}

main = (auto_accept_button: boolean = true) => {
window.autoAcceptQueueButtonSelect = this.autoAcceptQueueButtonSelect

upl.observer.subscribeToElementCreation(".v2-lobby-root-component.ember-view .v2-footer-notifications.ember-view",async (element: any) => {
const newOption = document.createElement("lol-uikit-radio-input-option")
const container = this.fetch_or_create_champselect_buttons_container()
const Option2 = document.createElement("div")

newOption.setAttribute("id", "autoAcceptQueueButton")
newOption.setAttribute("onclick", "window.autoAcceptQueueButtonSelect()")

Option2.classList.add("auto-accept-button-text")
Option2.innerHTML = await getString("auto_accept")

if (window.DataStore.get("auto_accept")){
newOption.setAttribute("selected", "")
}

if (element && !document.getElementById("autoAcceptQueueButton")) {
if (window.DataStore.get("auto_accept_button")) {
container?.append(newOption)
newOption.append(Option2)
}
}
await this.createButton(element)
})

upl.observer.subscribeToElementCreation(".tft-footer-container.ember-view .parties-footer-notifications.ember-view",async (element: any) => {
await this.createButton(element)
})

if (auto_accept_button) {
Expand Down
7 changes: 4 additions & 3 deletions src/src/plugins/customProfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ export class CustomProfile {
get: () => value,
set: (v) => v,
})
}catch {}
}
catch {}
}
}
}
Expand Down Expand Up @@ -247,7 +248,7 @@ export class CustomProfile {
}
}
}
catch{}
catch {}
})

upl.observer.subscribeToElementCreation(".collection-totals",(element: any)=>{
Expand Down Expand Up @@ -288,7 +289,7 @@ export class CustomProfile {
},3000)
}
}
catch{}
catch {}
})

upl.observer.subscribeToElementCreation(".crystal-wrapper",(element: any)=>{
Expand Down
23 changes: 15 additions & 8 deletions src/src/plugins/hideFriendlist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ export class HideFriendList {
get: () => value,
set: (v) => v,
})
}catch {}
}
catch {}
}
}
}
Expand Down Expand Up @@ -91,7 +92,8 @@ export class HideFriendList {
if (!hide) {
try {
document.querySelector("#centerViewport")?.remove();
} catch {}
}
catch {}
utils.addStyleWithID("centerViewport", `
.parties-game-type-select-wrapper.ember-view {
transform: translateX(0px);
Expand Down Expand Up @@ -139,7 +141,8 @@ export class HideFriendList {
else {
try {
document.querySelector("#centerViewport")?.remove();
} catch {}
}
catch {}
utils.addStyleWithID("centerViewport", `
.parties-game-type-select-wrapper.ember-view {
transform: translateX(113px);
Expand Down Expand Up @@ -227,7 +230,8 @@ export class HideFriendList {
bg[i].remove()
}
}
} catch {}
}
catch {}

this.createSidebarBackground()
})
Expand All @@ -242,11 +246,14 @@ export class HideFriendList {
button[i].remove()
}
}
} catch {}
}
catch {}

this.createButton()
this.buttonShowHideFriendlist(window.DataStore.get("HideFriendList"))
this.showHideFriendslist(window.DataStore.get("HideFriendList"))
if (window.DataStore.get("enable-hide-top-navbar-friendlist-button")) {
this.createButton()
this.buttonShowHideFriendlist(window.DataStore.get("HideFriendList"))
this.showHideFriendslist(window.DataStore.get("HideFriendList"))
}
})
}
}
2 changes: 1 addition & 1 deletion src/src/plugins/inviteAllFriends.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class InviteAllFriends {
log("Friends list refreshed.")
}
}
catch{}
catch {}
}

addInviteAllButton = async (): Promise<void> => {
Expand Down
12 changes: 7 additions & 5 deletions src/src/plugins/lootHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,12 @@ function AddContextMenu(title: any, subTitle: any, items: any[] = []) {
}

function OnClickRefreshButton() {
document.querySelectorAll('.loot-category-information').forEach(elem => {
elem.remove();
});
try {
document.querySelectorAll('.loot-category-information').forEach(elem => {
elem.remove();
});
}
catch {}
CreateChapmsInformation()
CreateSkinsInformation()
}
Expand Down Expand Up @@ -470,8 +473,7 @@ export class LootHelper {

upl.observer.subscribeToElementCreation((".loot-inventory-grid "), (element: any) => {
log("%cLoot helper loaded", "color: #e4c2b3")
CreateChapmsInformation()
CreateSkinsInformation()
OnClickRefreshButton()
})

upl.observer.subscribeToElementCreation((".loot-display-category-tabs-container"), (element: any) => {
Expand Down
11 changes: 6 additions & 5 deletions src/src/services/backupAndRestoreDatastore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { log, error } from '../utils/themeLog';
export class BackupRestoreData {
async importData(url: string): Promise<any> {
const controller = new AbortController();
const timeoutId = setTimeout(() => controller.abort(), 2000);
const timeoutId = setTimeout(() => controller.abort(), 3000);

try {
const res = await fetch(url, { signal: controller.signal });
Expand All @@ -15,10 +15,11 @@ export class BackupRestoreData {
return Data.default
}
else throw new Error();
} catch {
let errorMsg = "Can't load default datastore from local"
}
catch (err: any) {
let errorMsg = "Can't load default datastore from local: "
clearTimeout(timeoutId);
error(errorMsg);
error(errorMsg, err);
window.Toast.error(errorMsg);
}
};
Expand Down Expand Up @@ -93,6 +94,6 @@ try {
// Backup datastore
backupRestoreData.backup()
}
catch { error("Can not restore datastore") }
catch(err:any) { error("Can not restore datastore", err) }

window.restoreDefaultDataStore = restoreDefaultDataStore
20 changes: 0 additions & 20 deletions src/src/services/checkServer.ts

This file was deleted.

8 changes: 1 addition & 7 deletions src/src/theme/Cdninit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ let initLink: string

export async function cdnImport(url: string, errorMsg: any): Promise<any> {
const controller = new AbortController();
const timeoutId = setTimeout(() => controller.abort(), 2000);
const timeoutId = setTimeout(() => controller.abort(), 3000);

try {
const res = await fetch(url, { signal: controller.signal });
Expand Down Expand Up @@ -34,10 +34,4 @@ else {


const { Cdninit } = await cdnImport(initLink, "Failed to load Init data")
.then( res => { return res ? res : {} })
.catch( err => {
error("Failed to destructure init property", err)
window.restartClient()
});

export { Cdninit }
Loading

0 comments on commit 882f680

Please sign in to comment.