Skip to content

Commit

Permalink
Improve ‘Larger Size’ download link text.
Browse files Browse the repository at this point in the history
This hopefully clarifies the meaning of the link to avoid misunderstandings as in 

http://rentzsch.lighthouseapp.com/projects/24342/tickets/346-16b2-quicktime-larger-size-download

Also makes sure that the displayed links always match the actual situation. To achieve that all methods need to be passed the HD loading state rather than the URL to the video file.

Strings for the new links are added. fr localisation still missing.
  • Loading branch information
ssp committed Oct 9, 2009
1 parent 984d3b3 commit 9e791d3
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 37 deletions.
4 changes: 2 additions & 2 deletions Plugin/CTFKillerVideo.h
Expand Up @@ -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;
Expand Down
60 changes: 34 additions & 26 deletions Plugin/CTFKillerVideo.m
Expand Up @@ -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 ]) {
Expand Down Expand Up @@ -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];
}
Expand All @@ -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];
Expand All @@ -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];

Expand Down Expand Up @@ -734,7 +742,7 @@ - (void) increaseActiveLookups {

- (void) decreaseActiveLookups {
activeLookups--;
if ( [self lookupStatus] != failed ) {
if ( activeLookups == 0 && [self lookupStatus] != failed ) {
[self setLookupStatus: finished];
}
}
Expand Down
12 changes: 9 additions & 3 deletions Plugin/English.lproj/Localizable.strings
Expand Up @@ -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";
Expand Down
12 changes: 9 additions & 3 deletions Plugin/de.lproj/Localizable.strings
Expand Up @@ -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";
Expand Down
12 changes: 9 additions & 3 deletions Plugin/fr.lproj/Localizable.strings
Expand Up @@ -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 %@";
Expand Down

0 comments on commit 9e791d3

Please sign in to comment.