From f9869e675599bfb00244db0857917df527844044 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Fri, 24 Jan 2014 15:37:02 -0800 Subject: [PATCH] Add an updateStyles message to update the @medias. --- LockScreen.mm | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/LockScreen.mm b/LockScreen.mm index 9a37507..42d8f1e 100644 --- a/LockScreen.mm +++ b/LockScreen.mm @@ -262,6 +262,19 @@ class RegEx { /* }}} */ #endif +@interface DOMCSSStyleSheet : NSObject +- (int) addRule:(NSString *)rule style:(NSString *)style index:(unsigned)index; +- (void) deleteRule:(unsigned)index; +@end + +@interface DOMStyleSheetList : NSObject +- (DOMCSSStyleSheet *) item:(unsigned)index; +@end + +@interface DOMDocument : NSObject +- (DOMStyleSheetList *) styleSheets; +@end + static float CYScrollViewDecelerationRateNormal; @interface NSURL (Apple) @@ -299,6 +312,8 @@ static float CYScrollViewDecelerationRateNormal; @interface CydgetWebView : UIWebView { } +- (void) updateStyles; + @end MSClassHook(UIApplication) @@ -342,6 +357,12 @@ MSInstanceMessageHook0(BOOL, NSURL, isSpringboardHandledURL) { [super webView:view addMessageToConsole:message]; } +- (void) updateStyles { + DOMCSSStyleSheet *sheet([[[[[[self _documentView] webView] mainFrame] DOMDocument] styleSheets] item:0]); + [sheet addRule:@"cydget" style:@"color: black" index:0]; + [sheet deleteRule:0]; +} + @end @interface WebCydgetLockScreenView : UIView { @@ -350,6 +371,8 @@ MSInstanceMessageHook0(BOOL, NSURL, isSpringboardHandledURL) { NSString *cycript_; } +- (void) updateStyles; + @end @implementation WebCydgetLockScreenView @@ -490,6 +513,10 @@ MSInstanceMessageHook0(BOOL, NSURL, isSpringboardHandledURL) { } } +- (void) updateStyles { + [webview_ updateStyles]; +} + @end @interface WebCycriptLockScreenController : SBAwayViewPluginController { @@ -1232,6 +1259,11 @@ static void $UIWebViewWebViewDelegate$webView$didClearWindowObject$forFrame$(UIW [super purgeView]; } +- (void) updateStyles { + [foreground_ updateStyles]; + [background_ updateStyles]; +} + - (UIView *) backgroundView { return background_; } -- 2.45.2