diff --git a/Plugin/CTFKillerVideo.h b/Plugin/CTFKillerVideo.h index 19eeb20b..ce9bdfa2 100644 --- a/Plugin/CTFKillerVideo.h +++ b/Plugin/CTFKillerVideo.h @@ -103,8 +103,8 @@ enum CTFKVLookupStatus { - (void) _convertElementForVideoElement: (DOMElement*) element atURL: (NSString*) URLString; - (void) convertToMP4ContainerUsingHD: (NSNumber*) useHD; - (void) _convertToMP4ContainerAfterDelayUsingHD: (NSNumber*) useHDNumber; -- (void) convertToMP4ContainerAtURL: (NSString*) URLString; -- (DOMElement*) linkContainerElementForURL: (NSString*) URLString; +- (void) _convertToMP4ContainerUsingHD: (BOOL) useHD; +- (DOMElement*) linkContainerElementUsingHD: (BOOL) useHD; // Helpers - (BOOL) useVideo; diff --git a/Plugin/CTFKillerVideo.m b/Plugin/CTFKillerVideo.m index 34ff36a5..0ce15ec4 100644 --- a/Plugin/CTFKillerVideo.m +++ b/Plugin/CTFKillerVideo.m @@ -434,23 +434,21 @@ - (void) convertToMP4ContainerUsingHD: (NSNumber*) useHD -- (void) _convertToMP4ContainerAfterDelayUsingHD: (NSNumber*) useHDNumber -{ +- (void) _convertToMP4ContainerAfterDelayUsingHD: (NSNumber*) useHDNumber { BOOL useHD = [ self useVideoHD ]; if (useHDNumber != nil) { useHD = [useHDNumber boolValue]; } - - NSString * URLString = [self videoURLStringForHD: useHD]; - - [self convertToMP4ContainerAtURL: URLString]; + + [self _convertToMP4ContainerUsingHD: useHD]; } -- (void) convertToMP4ContainerAtURL: (NSString*) URLString { +- (void) _convertToMP4ContainerUsingHD: (BOOL) useHD { DOMElement * container = [[self plugin] container]; DOMDocument* document = [container ownerDocument]; + NSString * URLString = [self videoURLStringForHD: useHD]; DOMElement* videoElement; if ([ self isVideoElementAvailable ]) { @@ -479,7 +477,7 @@ - (void) convertToMP4ContainerAtURL: (NSString*) URLString { [CtFContainerElement setAttribute: @"class" value: @"clicktoflash-container"]; [CtFContainerElement appendChild: videoElement]; - DOMElement* linkContainerElement = [self linkContainerElementForURL:URLString]; + DOMElement* linkContainerElement = [self linkContainerElementUsingHD: useHD]; if ( linkContainerElement != nil ) { [CtFContainerElement appendChild: linkContainerElement]; } @@ -495,13 +493,14 @@ - (void) convertToMP4ContainerAtURL: (NSString*) URLString { -- (DOMElement*) linkContainerElementForURL: (NSString*) URLString { +- (DOMElement*) linkContainerElementUsingHD: (BOOL) useHD { + NSString * URLString = [self videoURLStringForHD: 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"]; - NSString * linkCSS = @"margin:0px 0.5em;padding:0px;border:0px none;"; // Link to the video's web page if we're not there already NSString * videoPageURLString = [self videoPageURLString]; @@ -520,37 +519,46 @@ - (DOMElement*) linkContainerElementForURL: (NSString*) URLString { [linkContainerElement appendChild: videoPageLinkElement]; } - // Link to Movie file download if possible - NSString * videoDownloadURLString = [self videoDownloadURLString]; - if ( videoDownloadURLString == nil ) { - videoDownloadURLString = URLString; - } - if ( videoDownloadURLString != nil ) { - DOMElement* downloadLinkElement = [document createElement: @"a"]; + // 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 videoURLString]]; [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 H.264 Download appearing beneath the video"); + videoDownloadLinkText = CtFLocalizedString(@"Download video file", @"Text of link to Video Download appearing beneath the video"); } [downloadLinkElement setTextContent: videoDownloadLinkText]; [linkContainerElement appendChild:downloadLinkElement]; } - - // offer additional link for HD download if available - if ( [self hasVideoHD] && ![self useVideoHD]) { - NSString * extraLinkCSS = @"margin:0px;padding:0px;border:0px none;"; + 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: extraLinkCSS]; + [extraDownloadLinkElement setAttribute: @"style" value: linkCSS]; [extraDownloadLinkElement setAttribute: @"class" value: @"clicktoflash-link videodownload"]; - [extraDownloadLinkElement setTextContent: CtFLocalizedString(@"(Larger Size)", @"Text of link to additional Large Size H.264 Download appearing beneath the video after the standard link")]; + [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]; @@ -734,7 +742,7 @@ - (void) increaseActiveLookups { - (void) decreaseActiveLookups { activeLookups--; - if ( [self lookupStatus] != failed ) { + if ( activeLookups == 0 && [self lookupStatus] != failed ) { [self setLookupStatus: finished]; } } diff --git a/Plugin/English.lproj/Localizable.strings b/Plugin/English.lproj/Localizable.strings index d6380965..a79ac65c 100644 --- a/Plugin/English.lproj/Localizable.strings +++ b/Plugin/English.lproj/Localizable.strings @@ -87,11 +87,17 @@ Additional Links for inserted QuickTime film */ -/* Text of link to H.264 Download appearing beneath the video */ +/* Text of link to Video Download appearing beneath the video */ "Download video file" = "Download Movie File"; -/* Text of link to additional Larger Size H.264 Download appearing beneath the video after the standard link */ -"(Larger Size)" = "(Larger Size)"; +/* Label for download links appearing beneath the video */ +"Download: " = "Download: "; + +/* Text of link for downloading a version of the video in the current size; appearing beneath the video */ +"Current Size" = "Current Size"; + +/* Text of link to additional Larger Size Video Download appearing beneath the video after the standard link */ +"Larger Size" = "Larger Size"; /* Text of link to the video page on SITENAME appearing beneath the video */ "Go to %@ Page" = "Go to %@ Page"; diff --git a/Plugin/de.lproj/Localizable.strings b/Plugin/de.lproj/Localizable.strings index d6730ccc..3f29705c 100644 --- a/Plugin/de.lproj/Localizable.strings +++ b/Plugin/de.lproj/Localizable.strings @@ -88,11 +88,17 @@ Additional Links for inserted QuickTime film */ -/* Text of link to H.264 Download appearing beneath the video */ +/* Text of link to Video Download appearing beneath the video */ "Download video file" = "Filmdatei laden"; -/* Text of link to additional Larger Size H.264 Download appearing beneath the video after the standard link */ -"(Larger Size)" = "(Größere Version)"; +/* Label for download links appearing beneath the video */ +"Download: " = "Filmdatei laden: "; + +/* Text of link for downloading a version of the video in the current size; appearing beneath the video */ +"Current Size" = "Aktuelle Größe"; + +/* Text of link to additional Larger Size Video Download appearing beneath the video after the standard link */ +"Larger Size" = "Größere Version"; /* Text of link to the video page on SITENAME appearing beneath the video */ "Go to %@ Page" = "%@ Seite öffnen"; diff --git a/Plugin/fr.lproj/Localizable.strings b/Plugin/fr.lproj/Localizable.strings index 8f0c60ec..7e1330db 100644 --- a/Plugin/fr.lproj/Localizable.strings +++ b/Plugin/fr.lproj/Localizable.strings @@ -87,11 +87,17 @@ Additional Links for inserted QuickTime film */ -/* Text of link to H.264 Download appearing beneath the video */ +/* Text of link to Video Download appearing beneath the video */ "Download video file" = "Télécharger le fichier film"; -/* Text of link to additional Larger Size H.264 Download appearing beneath the video after the standard link */ -"(Larger Size)" = "(Taille plus grande)"; +/* Label for download links appearing beneath the video */ +"Download: " = "Download: "; + +/* Text of link for downloading a version of the video in the current size; appearing beneath the video */ +"Current Size" = "Current Size"; + +/* Text of link to additional Larger Size Video Download appearing beneath the video after the standard link */ +"Larger Size" = "Taille plus grande"; /* Text of link to the video page on SITENAME appearing beneath the video */ "Go to %@ Page" = "Aller à la page %@";