Permalink
Browse files

Merge branch 'ssp-cutting-edge' into ssp-integrate

  • Loading branch information...
2 parents fa68edb + 4dd9eb9 commit cea5059e321c50d0ade2afb8ee72248b7df900ea @mbaltaks committed Dec 16, 2009
Showing with 20,870 additions and 5,555 deletions.
  1. +26 −0 CTFKillerVideo-HTML.h
  2. +280 −0 CTFKillerVideo-HTML.m
  3. +47 −0 CTFKillerVideo-QT.h
  4. +474 −0 CTFKillerVideo-QT.m
  5. +452 −72 ClickToFlash.xcodeproj/project.pbxproj
  6. +2 −2 Installer/Info.plist
  7. +0 −1,726 Installer/appcast.xml
  8. +6 −1 Installer/build_installer_pkg.command
  9. BIN Installer/resources/background.tiff
  10. +21 −0 Installer/resources/de.lproj/ReadMe.rtf
  11. +7 −11 Installer/resources/en.lproj/ReadMe.rtf
  12. BIN Installer/resources/en.lproj/background.tiff
  13. +24 −0 Installer/resources/fr.lproj/ReadMe.rtf
  14. +33 −0 Plugin/CTFAboutBoxWindowController.h
  15. +69 −0 Plugin/CTFAboutBoxWindowController.m
  16. +53 −0 Plugin/CTFActionButton.h
  17. +200 −0 Plugin/CTFActionButton.m
  18. +35 −0 Plugin/CTFButton.h
  19. +41 −0 Plugin/CTFButton.m
  20. +43 −0 Plugin/CTFButtonsView.h
  21. +167 −0 Plugin/CTFButtonsView.m
  22. +41 −0 Plugin/CTFFullScreenWindow.h
  23. +83 −0 Plugin/CTFFullscreenWindow.m
  24. +7 −6 Plugin/{CTGradient.h → CTFGradient.h}
  25. +14 −14 Plugin/{CTGradient.m → CTFGradient.m}
  26. +90 −0 Plugin/CTFKiller.h
  27. +204 −0 Plugin/CTFKiller.m
  28. +50 −0 Plugin/CTFKillerSIFR.h
  29. +202 −0 Plugin/CTFKillerSIFR.m
  30. +145 −0 Plugin/CTFKillerVideo.h
  31. +645 −0 Plugin/CTFKillerVideo.m
  32. +57 −0 Plugin/CTFKillerVimeo.h
  33. +312 −0 Plugin/CTFKillerVimeo.m
  34. +55 −0 Plugin/CTFKillerYouTube.h
  35. +365 −0 Plugin/CTFKillerYouTube.m
  36. +66 −0 Plugin/CTFLoader.h
  37. +233 −0 Plugin/CTFLoader.m
  38. +60 −0 Plugin/CTFMainButton.h
  39. +515 −0 Plugin/CTFMainButton.m
  40. +7 −2 Plugin/CTFMenubarMenuController.h
  41. +37 −5 Plugin/CTFMenubarMenuController.m
  42. 0 Plugin/CTFPreferencesDictionary.h
  43. +0 −27 Plugin/CTFURLConnection.h
  44. +0 −102 Plugin/CTFURLConnection.m
  45. 0 Plugin/CTFUserDefaultsController.h
  46. +49 −1 Plugin/CTFUtilities.h
  47. +1 −1 Plugin/CTFUtilities.m
  48. +2 −3 Plugin/CTFWhitelist.h
  49. +82 −84 Plugin/CTFWhitelist.m
  50. +5 −0 Plugin/CTFWhitelistWindowController.h
  51. +34 −9 Plugin/CTFWhitelistWindowController.m
  52. +0 −40 Plugin/CTFsIFRSupport.h
  53. +0 −118 Plugin/CTFsIFRSupport.m
  54. +17 −0 Plugin/Credits.css
  55. +772 −0 Plugin/English.lproj/AboutBox.xib
  56. +0 −337 Plugin/English.lproj/ContextualMenu.xib
  57. +21 −0 Plugin/English.lproj/Credits.html
  58. +2 −0 Plugin/English.lproj/InfoPlist.strings
  59. +156 −0 Plugin/English.lproj/Localizable.strings
  60. +298 −52 Plugin/English.lproj/MenubarMenu.xib
  61. +2,493 −0 Plugin/English.lproj/Preferences.xib
  62. +0 −2 Plugin/Info-Plugin.plist
  63. +0 −106 Plugin/MATrackingArea.h
  64. +0 −432 Plugin/MATrackingArea.m
  65. +93 −26 Plugin/Plugin.h
  66. +845 −950 Plugin/Plugin.m
  67. +7 −1 Plugin/Sparkle/SUBasicUpdateDriver.m
  68. +50 −11 Plugin/Sparkle/SUHost.m
  69. +10 −5 Plugin/Sparkle/SUInstaller.m
  70. +1 −1 Plugin/Sparkle/SUUIBasedUpdateDriver.m
  71. +3 −0 Plugin/Sparkle/SUUpdater.h
  72. +10 −40 Plugin/Sparkle/Sparkle.xcodeproj/project.pbxproj
  73. BIN Plugin/Sparkle/de.lproj/Sparkle.strings
  74. BIN Plugin/Sparkle/en.lproj/Sparkle.strings
  75. BIN Plugin/Sparkle/es.lproj/Sparkle.strings
  76. BIN Plugin/Sparkle/fr.lproj/Sparkle.strings
  77. BIN Plugin/Sparkle/it.lproj/Sparkle.strings
  78. BIN Plugin/Sparkle/nl.lproj/Sparkle.strings
  79. BIN Plugin/Sparkle/ru.lproj/Sparkle.strings
  80. BIN Plugin/Sparkle/sv.lproj/Sparkle.strings
  81. +13 −35 Plugin/SparkleManager.h
  82. +111 −128 Plugin/SparkleManager.m
  83. +772 −0 Plugin/de.lproj/AboutBox.xib
  84. +21 −0 Plugin/de.lproj/Credits.html
  85. +2 −0 Plugin/de.lproj/InfoPlist.strings
  86. +144 −0 Plugin/de.lproj/Localizable.strings
  87. +533 −0 Plugin/de.lproj/MenubarMenu.xib
  88. +2,497 −0 Plugin/de.lproj/Preferences.xib
  89. BIN Plugin/download.png
  90. +20 −0 Plugin/dsa_pub.pem
  91. +772 −0 Plugin/fr.lproj/AboutBox.xib
  92. +21 −0 Plugin/fr.lproj/Credits.html
  93. +2 −0 Plugin/fr.lproj/InfoPlist.strings
  94. +144 −0 Plugin/fr.lproj/Localizable.strings
  95. +533 −0 Plugin/fr.lproj/MenubarMenu.xib
  96. +1,109 −1,188 Plugin/{English.lproj/WhitelistPanel.xib → fr.lproj/Preferences.xib}
  97. +108 −16 README.markdown
  98. +8 −1 Rakefile
  99. +16 −0 Updater/CTFSparkleManager.h
  100. +135 −0 Updater/CTFSparkleManager.m
  101. +40 −0 Updater/Info-Updater.plist
  102. +3,689 −0 Updater/MainMenu.xib
  103. +2 −0 Updater/de.lproj/InfoPlist.strings
  104. +13 −0 Updater/de.lproj/Localizable.strings
  105. +2 −0 Updater/en.lproj/InfoPlist.strings
  106. +13 −0 Updater/en.lproj/Localizable.strings
  107. +2 −0 Updater/fr.lproj/InfoPlist.strings
  108. +15 −0 Updater/fr.lproj/Localizable.strings
  109. +14 −0 Updater/main.m
View
@@ -0,0 +1,26 @@
+//
+// CTFKillerVideo-HTML.h
+// ClickToFlash
+//
+// Created by Sven on 13.12.09.
+// Copyright 2009 earthlingsoft. All rights reserved.
+//
+
+#import <Cocoa/Cocoa.h>
+#import "CTFKillerVideo.h"
+
+@interface CTFKillerVideo (HTML)
+
+- (void) _convertElementForMP4: (DOMElement*) element atURL: (NSString*) URLString;
+- (void) _convertElementForVideoElement: (DOMElement*) element atURL: (NSString*) URLString;
+- (void) convertToMP4ContainerUsingHD: (NSNumber*) useHD;
+- (void) _convertToMP4ContainerAfterDelayUsingHD: (NSNumber*) useHDNumber;
+- (void) _convertToMP4ContainerUsingHD: (BOOL) useHD;
+- (DOMElement*) linkContainerElementUsingHD: (BOOL) useHD;
+
+// Helper
+- (BOOL) isVideoElementAvailable;
+
+
+
+@end
View
@@ -0,0 +1,280 @@
+//
+// CTFKillerVideo-HTML.m
+// ClickToFlash
+//
+// Created by Sven on 13.12.09.
+// Copyright 2009 earthlingsoft. All rights reserved.
+//
+
+#import "CTFKillerVideo-HTML.h"
+#import "CTFKillerVideo.h"
+#import "Plugin.h"
+#import "CTFUserDefaultsController.h"
+#import <WebKit/WebKit.h>
+
+static NSString * divCSS = @"margin:auto;padding:0px;border:0px none;text-align:center;display:block;float:none;";
+
+
+
+
+@implementation CTFKillerVideo (HTML)
+
+
+#pragma mark -
+#pragma mark Insert Video using the DOM
+
+- (void) _convertElementForMP4: (DOMElement*) element atURL: (NSString*) URLString {
+ // some tags (OBJECT) want a data attribute, and some want a src attribute
+ // for some reason, though, some cloned elements are not reporting themselves
+ // as OBJECT tags, even though they are; more investigation on this is needed,
+ // but for now, setting both the data and the src attribute corrects the problem
+ // (see bug #294)
+
+ [ element setAttribute: @"data" value: URLString ];
+ [ element setAttribute: @"src" value: URLString ];
+ [ element setAttribute: @"type" value: @"video/mp4" ];
+ [ element setAttribute: @"scale" value: @"aspect" ];
+ if ([self autoPlay]) {
+ [ element setAttribute: @"autoplay" value: @"true" ];
+ } else {
+ [ element setAttribute: @"autoplay" value: @"false" ];
+ }
+ [ element setAttribute: @"cache" value: @"false" ];
+ [ element setAttribute: @"bgcolor" value: @"transparent" ];
+ [ element setAttribute: @"flashvars" value: nil ];
+}
+
+
+
+- (void) _convertElementForVideoElement: (DOMElement*) element atURL: (NSString*) URLString {
+ [ element setAttribute: @"src" value: URLString ];
+ if ([self autoPlay]) {
+ [ element setAttribute: @"autoplay" value:@"autoplay" ];
+ } else {
+ if ( [element hasAttribute:@"autoplay"] )
+ [ element removeAttribute:@"autoplay" ];
+ }
+ if ([[self plugin] previewURL] != nil) {
+ [element setAttribute: @"poster" value: [[[self plugin] previewURL] absoluteString]];
+ }
+ [ element setAttribute: @"controls" value:@"controls"];
+ [ element setAttribute:@"width" value:@"100%"];
+}
+
+
+
+/*
+ The useHD parameter indicates whether we want to override the default behaviour to use or not use HD.
+ Passing nil invokes the default behaviour based on user preferences and HD availability.
+*/
+- (void) convertToMP4ContainerUsingHD: (NSNumber*) useHD {
+ [plugin revertToOriginalOpacityAttributes];
+
+ // Delay this until the end of the event loop, because it may cause self to be deallocated
+ [plugin prepareForConversion];
+ [self performSelector:@selector(_convertToMP4ContainerAfterDelayUsingHD:) withObject:useHD afterDelay:0.0];
+}
+
+
+
+
+- (void) _convertToMP4ContainerAfterDelayUsingHD: (NSNumber*) useHDNumber {
+ BOOL useHD = [ self useVideoHD ];
+ if (useHDNumber != nil) {
+ useHD = [useHDNumber boolValue];
+ }
+
+ [self _convertToMP4ContainerUsingHD: useHD];
+}
+
+
+
+/*
+ Replace our plugin element in DOM by a <video> or <embed> element for the video.
+*/
+- (void) _convertToMP4ContainerUsingHD: (BOOL) useHD {
+ DOMElement * container = [[self plugin] container];
+ DOMDocument * document = [container ownerDocument];
+ NSString * URLString = [self videoURLStringForHD: useHD];
+
+ DOMElement * videoElement;
+ if ([ self isVideoElementAvailable ]) {
+ // replace with HTML 5 <video> element
+ videoElement = [document createElement:@"video"];
+ [ self _convertElementForVideoElement: videoElement atURL: URLString ];
+ } else {
+ // replace with <embed> tag for QuickTime video
+ videoElement = (DOMElement*) [container cloneNode: NO ];
+ [ self _convertElementForMP4: videoElement atURL: URLString ];
+ }
+
+
+ DOMNode * widthNode = [[container attributes ] getNamedItem:@"width"];
+ NSString * width = @"100%"; // default to 100% width
+ if (widthNode != nil) {
+ // width is already set explicitly, preserve that
+ width = [widthNode nodeValue];
+ if ( [[NSCharacterSet decimalDigitCharacterSet] characterIsMember:[width characterAtIndex:[width length] - 1]] ) {
+ // add 'px' if existing width is just a number (ends with a digit)
+ width = [width stringByAppendingString:@"px"];
+ }
+ }
+ NSString * widthCSS = [NSString stringWithFormat:@"%@width:%@;", divCSS, width];
+
+ DOMElement * CtFContainerElement = [document createElement: @"div"];
+ [CtFContainerElement setAttribute: @"style" value: widthCSS];
+ [CtFContainerElement setAttribute: @"class" value: @"clicktoflash-container"];
+ [CtFContainerElement appendChild: videoElement];
+
+ DOMElement * linkContainerElement = [self linkContainerElementUsingHD: useHD];
+ if ( linkContainerElement != nil ) {
+ [CtFContainerElement appendChild: linkContainerElement];
+ }
+
+ // Just to be safe, since we are about to replace our containing element
+ [[self retain] autorelease];
+
+ // Replace self with element.
+ [[container parentNode] replaceChild: CtFContainerElement oldChild: container];
+
+ [[self plugin] setContainer:nil];
+}
+
+
+
+- (DOMElement*) linkContainerElementUsingHD: (BOOL) useHD {
+ // Link container
+ DOMDocument* document = [[[self plugin] container] ownerDocument];
+ DOMElement* linkContainerElement = [document createElement: @"div"];
+ NSString * linkCSS = @"margin:0px 0.5em;padding:0px;border:0px none;";
+ [linkContainerElement setAttribute: @"style" value: divCSS];
+ [linkContainerElement setAttribute: @"class" value: @"clicktoflash-linkcontainer"];
+
+ // Link to the video's web page if we're not there already
+ NSString * videoPageURLString = [self videoPageURLString];
+ if ( videoPageURLString != nil && ![self isOnVideoPage] ) {
+ DOMElement* videoPageLinkElement = [document createElement: @"a"];
+ [videoPageLinkElement setAttribute: @"href" value: videoPageURLString];
+ [videoPageLinkElement setAttribute: @"style" value: linkCSS];
+ [videoPageLinkElement setAttribute: @"class" value: @"clicktoflash-link"];
+ NSString * videoPageLinkText = [self videoPageLinkText];
+ if (videoPageLinkText == nil) {
+ NSString * formatString = CtFLocalizedString(@"Go to %@ Page", @"Text of link to the video page on SITENAME appearing beneath the video");
+ videoPageLinkText = [NSString stringWithFormat:formatString, [self siteName]];
+ }
+ [videoPageLinkElement setTextContent: videoPageLinkText];
+
+ [linkContainerElement appendChild: videoPageLinkElement];
+ }
+
+ // Link to Movie file download(s)
+ DOMElement* downloadLinkElement;
+
+ if ( !([self hasVideoHD] && !useHD) ) {
+ // standard case with a single link
+ downloadLinkElement = [document createElement: @"a"];
+ [downloadLinkElement setAttribute: @"href" value: [self videoURLStringForHD: useHD]];
+ [downloadLinkElement setAttribute: @"style" value: linkCSS];
+ [downloadLinkElement setAttribute: @"class" value: @"clicktoflash-link videodownload"];
+ NSString * videoDownloadLinkText = [self videoDownloadLinkText];
+ if (videoDownloadLinkText == nil) {
+ videoDownloadLinkText = CtFLocalizedString(@"Download video file", @"Text of link to Video Download appearing beneath the video");
+ }
+ [downloadLinkElement setTextContent: videoDownloadLinkText];
+
+ [linkContainerElement appendChild:downloadLinkElement];
+ }
+ else {
+ // special case with a HD video available but HD turned off: offer links for downloading the standard and the larger size
+ linkCSS = @"margin:0px 0.3em;padding:0px;border:0px none;";
+
+ DOMElement * initialTextElement = [document createElement: @"span"];
+ [initialTextElement setTextContent: CtFLocalizedString(@"Download: ", @"Label for download links appearing beneath the video")];
+ [linkContainerElement appendChild: initialTextElement];
+
+ downloadLinkElement = [document createElement: @"a"];
+ [downloadLinkElement setAttribute: @"href" value: [self videoURLString]];
+ [downloadLinkElement setAttribute: @"style" value: linkCSS];
+ [downloadLinkElement setAttribute: @"class" value: @"clicktoflash-link videodownload"];
+ [downloadLinkElement setTextContent: CtFLocalizedString(@"Current Size", @"Text of link for downloading a version of the video in the current size; appearing beneath the video")];
+ [linkContainerElement appendChild: downloadLinkElement];
+
+ DOMElement * extraDownloadLinkElement = [document createElement: @"a"];
+ [extraDownloadLinkElement setAttribute: @"href" value: [self videoHDURLString]];
+ [extraDownloadLinkElement setAttribute: @"style" value: linkCSS];
+ [extraDownloadLinkElement setAttribute: @"class" value: @"clicktoflash-link videodownload"];
+ [extraDownloadLinkElement setTextContent: CtFLocalizedString(@"Larger Size", @"Text of link to additional Large Size Video Download appearing beneath the video after the standard link")];
+ [linkContainerElement appendChild: extraDownloadLinkElement];
+ }
+
+ // Let subclasses add their own link (or delete ours)
+ linkContainerElement = [self enhanceVideoDescriptionElement: linkContainerElement];
+
+ return linkContainerElement;
+}
+
+
+
+
+#pragma mark -
+#pragma mark Helper
+
+
+- (BOOL) isVideoElementAvailable
+{
+ if ( [[CTFUserDefaultsController standardUserDefaults] boolForKey:sDisableVideoElementDefaultsKey] )
+ return NO;
+
+ /* <video> element compatibility was added to WebKit in or shortly before version 525. */
+
+ NSBundle* webKitBundle;
+ webKitBundle = [ NSBundle bundleForClass: [ WebView class ] ];
+ if (webKitBundle) {
+ /* ref. http://lists.apple.com/archives/webkitsdk-dev/2008/Nov/msg00003.html:
+ * CFBundleVersion is 5xxx.y on WebKits built to run on Leopard, 4xxx.y on Tiger.
+ * Unspecific builds (such as the ones in OmniWeb) get xxx.y numbers without a prefix.
+ */
+ int normalizedVersion;
+ float wkVersion = [ (NSString*) [ [ webKitBundle infoDictionary ]
+ valueForKey: @"CFBundleVersion" ]
+ floatValue ];
+ if (wkVersion > 4000)
+ normalizedVersion = (int)wkVersion % 1000;
+ else
+ normalizedVersion = wkVersion;
+
+ // unfortunately, versions of WebKit above 531.5 also introduce a nasty
+ // scrolling bug with video elements that cause them to be unviewable;
+ // this bug was fixed shortly after being reported by @simX, so we can
+ // now re-enable it for correct WebKit versions
+ //
+ // this bug actually only affected certain machines that had graphics
+ // cards with a certain max texture size, and it was partially fixed, but
+ // still didn't work for MacBooks with embedded graphics, and we could
+ // detect that if we really wanted, but that would require importing
+ // the OpenGL framework, which we probably shouldn't do, so we'll just
+ // wholesale disable for certain WebKit versions
+ //
+ // https://bugs.webkit.org/show_bug.cgi?id=28705
+
+ if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_5) {
+ // Snowy Leopard; this bug doesn't seem to be exhibited here
+ return (normalizedVersion >= 525);
+ } else {
+ // this bug was introduced in version 531.5, but has been fixed in
+ // 532 and above
+
+ return ((normalizedVersion >= 532) ||
+ ((normalizedVersion >= 525) && (normalizedVersion < 531.5))
+ );
+ }
+ }
+ return NO;
+}
+
+
+
+
+
+
+@end
View
@@ -0,0 +1,47 @@
+//
+// CTFKillerVideo-QT.h
+// ClickToFlash
+//
+// Created by Sven on 13.12.09.
+// Copyright 2009 earthlingsoft. All rights reserved.
+//
+
+#import <Cocoa/Cocoa.h>
+#import "CTFKillerVideo.h"
+
+
+@interface CTFKillerVideo (QuickTime)
+
++ (BOOL) shouldUseQTKit;
+
+
+// QuickTime
+- (void) setupQuickTimeUsingHD: (NSNumber*) useHDNumber;
+- (void) reallySetupQuickTimeUsingHD: (NSNumber *) useHDNumber;
+- (QTMovie *) movieForHD: (NSNumber *) useHDNumber;
+- (void) addProgressIndicator;
+- (void) removeProgressIndicator;
+- (void) adjustButtonPositions: (BOOL) smoothly;
+- (NSButton *) addHDButton;
+- (NSButton *) addDownloadButton;
+- (void) addButtons;
+- (IBAction) toggleHD: (id) sender;
+// - (void) resizeToFitMovie;
+
+
+// Accessors
+- (BOOL) hasAutoPlayed;
+- (void) setHasAutoPlayed:(BOOL)newHasAutoPlayed;
+- (NSCellStateValue) usingHD;
+- (void) setUsingHD:(NSCellStateValue)newUsingHD;
+- (NSProgressIndicator *) progressIndicator;
+- (void) setProgressIndicator: (NSProgressIndicator *) newProgressIndicator;
+- (QTMovieView *) movieView;
+- (void) setMovieView: (QTMovieView *) newMovieView;
+- (QTMovie *) movie;
+- (void) setMovie: (QTMovie *) newMovie;
+- (NSThread *) movieSetupThread;
+- (void) setMovieSetupThread: (NSThread *) newMovieSetupThread;
+
+
+@end
Oops, something went wrong.

0 comments on commit cea5059

Please sign in to comment.