Skip to content

Commit

Permalink
JS Filename now in json
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonius7 committed Nov 19, 2022
1 parent a1409b5 commit 2b5d520
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 12 deletions.
3 changes: 2 additions & 1 deletion backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -1022,9 +1022,10 @@ def clean_slate_css():
#rewrite so not hardcoded
def clear_js_working_files():
try:
json_data = get_json_data()
files_to_remove = ["library.js", "library.beaut.js", "library.js.original",
"libraryroot.js", "libraryroot.beaut.js", "libraryroot.js.original",
"2783.js", "2783.beaut.js", "2783.js.original"]
json_data["jsFile"], json_data["jsBeautFile"], json_data["jsOriginalFile"]]
for file in files_to_remove:
w_file = Path(file)
w_file.unlink(missing_ok=True)
Expand Down
6 changes: 3 additions & 3 deletions fixes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ PortraitWidthMedium: "148px", PortraitWidthMedium: "140px",
PortraitWidthLarge: "222px", PortraitWidthLarge: "200px",

### === Landscape Images JS Tweaks (beta, working, some layout quirks with shelves) ===
###t = Math.max(1, Math.min(m, Math.floor((e + c) / g))); t = Math.max(1, Math.min(m, Math.floor((e + c) / g)) + 1);
###t = Math.max(1, Math.min(p, Math.floor((e + d) / g))); t = Math.max(1, Math.min(p, Math.floor((e + d) / g)) + 1);
###eAssetType: 0 eAssetType: 3
###n = 1.5 * r n = 43 / 92 * r
###i = 1.5 * r i = 43 / 92 * r

### === Stop What's New Events from Loading ===
###C.De.STORE_BASE_URL + "events/ajaxgetbesteventsforuser" ""

### === Press Enter to launch games ===
switch (t) {~~case 38: case 13: return this.RunApp(b.g4.currentGameListSelection.nAppId), void e.preventDefault();case 38:
switch (t) {~~case 38: case 13: return this.RunApp(S.g4.currentGameListSelection.nAppId), void e.preventDefault();case 38:
MoveRangeSelectUpOneRow() { RunApp(e) {window.location.href = "steam://rungameid/" + e;} MoveRangeSelectUpOneRow() {

### === Expand Show more Details panel by default ===
Expand Down
8 changes: 6 additions & 2 deletions js_tweaker.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
import rjsmin
import time

import backend

LOCAL_DEBUG = 0 #Set to 1 to not copy files to/from Steam directory

# Determine Steam Library Path
Expand All @@ -20,6 +22,8 @@

fixes_dict = {}

json_data = backend.get_json_data()

def initialise():
fixes_dict.clear() #not fixes_dict = {}

Expand All @@ -42,7 +46,7 @@ def library_dir():

######

files_to_copy = ["library.js", "libraryroot.js","2783.js"]
files_to_copy = ["library.js", "libraryroot.js",json_data["jsFile"]]

def copy_files_from_steam(reset=0): #set reset to 1 to overwrite files with fresh copy (useful for updates)
try:
Expand Down Expand Up @@ -272,7 +276,7 @@ def copy_files_to_steam():
if LOCAL_DEBUG == 0:
files_to_copy = {"librery.js": "library.js",
"libraryreet.js": "libraryroot.js",
"2784.js": "2783.js"}
json_data["jsPatchedFile"]: json_data["jsFile"]}
for filename in files_to_copy:
shutil.copy2(filename, library_dir() + "/" + files_to_copy[filename])
print("File " + filename + " written to " + library_dir() + "/" + files_to_copy[filename])
Expand Down
10 changes: 5 additions & 5 deletions old_glory.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@

class OldGloryApp(tk.Tk):
def __init__(self, *args, **kwargs):
self.version = "v0.9.27.5"
self.release = "5.10.3"
self.version = "v0.9.27.6"
self.release = "5.10.4-pre1"

### Window Frame
tk.Tk.__init__(self, *args, **kwargs)
Expand Down Expand Up @@ -927,15 +927,15 @@ def run_js_tweaker(controller, reset=0, max_stage=10):
if max_stage >= 2:
run_and_update_tkinter(lambda: js_tweaker.beautify_js(), text_area)
run_and_update_tkinter(lambda: js_tweaker.beautify_js("library.js"), text_area)
run_and_update_tkinter(lambda: js_tweaker.beautify_js("2783.js"), text_area)
run_and_update_tkinter(lambda: js_tweaker.beautify_js(controller.json_data["jsFile"]), text_area)
run_and_update_tkinter(lambda: js_tweaker.parse_fixes_file("fixes.txt"), text_area)
if max_stage >= 3:
run_and_update_tkinter(lambda: js_tweaker.write_modif_file(), text_area)
run_and_update_tkinter(lambda: js_tweaker.write_modif_file("library.js"), text_area)
run_and_update_tkinter(lambda: js_tweaker.write_modif_file("2783.js"), text_area)
run_and_update_tkinter(lambda: js_tweaker.write_modif_file(controller.json_data["jsFile"]), text_area)
run_and_update_tkinter(lambda: js_tweaker.re_minify_file(), text_area)
run_and_update_tkinter(lambda: js_tweaker.re_minify_file("library.modif.js", "librery.js"), text_area)
run_and_update_tkinter(lambda: js_tweaker.re_minify_file("2783.modif.js", "2784.js"), text_area)
run_and_update_tkinter(lambda: js_tweaker.re_minify_file(controller.json_data["jsModifFile"], controller.json_data["jsPatchedFile"]), text_area)
if max_stage >= 4:
run_and_update_tkinter(lambda: js_tweaker.compress_newlines("librery.js"), text_area)
run_and_update_tkinter(lambda: js_tweaker.compress_newlines("libraryreet.js"), text_area)
Expand Down
7 changes: 6 additions & 1 deletion old_glory_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
"CSSBeforeThemes": "// Themes applied before CSS Tweaks",
"CSSAfterThemes": "// Themes applied after CSS Tweaks",
"libraryrootFile": "2.css",
"lastPatchedDate": "2022-10-07T05:06:12Z",
"jsFile": "sp.js",
"jsBeautFile": "sp.beaut.js",
"jsModifFile": "sp.modif.js",
"jsPatchedFile": "sq.js",
"jsOriginalFile": "sp.js.original",
"lastPatchedDate": "2022-11-18T05:06:12Z",
"themes": {
"steam-library": {
"author": "Shiina",
Expand Down

0 comments on commit 2b5d520

Please sign in to comment.