Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
mmmago authored Feb 4, 2023
1 parent 5b2780e commit d36706e
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 9 deletions.
47 changes: 38 additions & 9 deletions Tweak.xm
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,52 @@


//Change every single UIView BG to black, except the UIButtons and the newspaper view


%hook UIView
- (void)setBackgroundColor:(UIColor *)color {
if ([self isKindOfClass:NSClassFromString(@"UITabBarButtonLabel")] ||
[self isKindOfClass:NSClassFromString(@"UIButton")]||
[self isKindOfClass:NSClassFromString(@"UIButtonLabel")]||
[self.superview isKindOfClass:NSClassFromString(@"EditionContentView")]||
self.frame.size.height == 47) { //exclude the login buttons
CGFloat red, green, blue, alpha;
[color getRed:&red green:&green blue:&blue alpha:&alpha];
if (red == 18.0/255.0 && green == 58.0/255.0 && blue == 116.0/255.0 && self.subviews.count == 0){
// color is blue(18,58,116), don't modify
%orig(color);

}
else if (self.frame.size.height == 38 && [color isEqual:[UIColor whiteColor]]) {
%orig(color=[UIColor blackColor]);
} else if ([self isKindOfClass:NSClassFromString(@"UITabBarButtonLabel")] ||
[self isKindOfClass:NSClassFromString(@"UIButton")] ||
[self isKindOfClass:NSClassFromString(@"UIButtonLabel")] ||
[self.superview isKindOfClass:NSClassFromString(@"EditionContentView")] ||
self.frame.size.height == 47||
self.frame.size.height == 44||
self.frame.size.height == 22||
self.frame.size.height == 38||
self.frame.size.height == 20||
self.frame.size.height == 1){ //exclude various UI Elements
%orig(color);
} else {
}
else {
%orig(color=[UIColor blackColor]);
}
}
%end


// [self.backgroundColor isEqual:[UIColor colorWithRed:18/255.0 green:58/255.0 blue:116/255.0 alpha:1.0]]||
// [self.backgroundColor isEqual:[UIColor colorWithRed:17/255.0 green:58/255.0 blue:116/255.0 alpha:1.0]]||
// [self.superview isKindOfClass:NSClassFromString(@"UIDropShadowView")]||
// [self isKindOfClass:NSClassFromString(@"MainViewController")] ||
// [self isKindOfClass:NSClassFromString(@"UIViewController")] ||
//[NSStringFromClass([self.superview class]) isEqualToString:@"LeSoir.MainViewController"]||
// [NSStringFromClass([self class]) isEqualToString:@"LeSoir_MainViewController"] ||
// [NSStringFromClass([self class]) isEqualToString:@"UIWindow"] ||
// [NSStringFromClass([self class]) isEqualToString:@"UIDropShadowView"]

//Change the detailed article view colors. Might need some tweakings to trigger faster.

%hook WKWebView
- (void)evaluateJavaScript:(NSString *)javaScriptString completionHandler:(void (^)(id, NSError *))completionHandler {
javaScriptString = [NSString stringWithFormat:@"document.body.style.backgroundColor = 'black'; document.body.style.color = 'white'; var header = document.getElementsByTagName('h1')[0]; header.style.color = 'white'; %@", javaScriptString];
javaScriptString = [NSString stringWithFormat:@"document.body.style.backgroundColor = 'black'; document.body.style.color = 'white'; var header = document.getElementsByTagName('h1')[0]; header.style.color = 'white'; var allElements = document.getElementsByTagName('*'); for (var i = 0; i < allElements.length; i++) { if (allElements[i].offsetHeight > 10) { allElements[i].style.color = 'white'; } }; %@", javaScriptString];
%orig(javaScriptString, completionHandler);
}
%end
Expand All @@ -33,7 +59,7 @@
%hook UITabBar
- (void)layoutSubviews {
%orig;
self.backgroundColor = [UIColor blackColor];
self.backgroundColor = [UIColor blackColor];
for (UIView *subview in self.subviews) {
if ([subview isKindOfClass:NSClassFromString(@"_UIBarBackground")]) {
subview.hidden = YES;
Expand All @@ -57,6 +83,7 @@
}
%end


//Hide a blackviewad
%hook DetailPdfAdViewController
- (void)viewDidLoad {
Expand All @@ -68,6 +95,7 @@
}
%end


//Change every UILabel to white (and force them to stay)
%hook UILabel
- (void)setTextColor:(UIColor *)color {
Expand Down Expand Up @@ -114,6 +142,7 @@
[alert addAction:ok];
[self presentViewController:alert animated:YES completion:nil];
}

}
%end

Binary file modified lesoirdark.dylib
Binary file not shown.

0 comments on commit d36706e

Please sign in to comment.