From c83c785e8d73fb9baccc7671c3b74be6ead04344 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Sat, 12 Sep 2015 09:25:38 -0700 Subject: [PATCH] Avoid modifying stylesheets when updating @medias. --- WebCycript.mm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/WebCycript.mm b/WebCycript.mm index 3ab6d09..ed58f72 100644 --- a/WebCycript.mm +++ b/WebCycript.mm @@ -120,6 +120,8 @@ static bool iOS32, iOS4; @end @interface DOMDocument : NSObject +- (NSString *) selectedStylesheetSet; +- (void) setSelectedStylesheetSet:(NSString *)value; - (DOMStyleSheetList *) styleSheets; @end @@ -167,9 +169,8 @@ MSInstanceMessageHook0(BOOL, NSURL, isSpringboardHandledURL) { @implementation UIWebView (WebCycript) - (void) updateStyles { - DOMCSSStyleSheet *sheet([[[[[[self _documentView] webView] mainFrame] DOMDocument] styleSheets] item:0]); - [sheet addRule:@"cydget" style:@"color: black" index:0]; - [sheet deleteRule:0]; + DOMDocument *document([[[[self _documentView] webView] mainFrame] DOMDocument]); + [document setSelectedStylesheetSet:[document selectedStylesheetSet]]; } @end -- 2.7.4