From 65e076288b92033737e2fb5246f361955c14b13a Mon Sep 17 00:00:00 2001 From: rentzsch Date: Tue, 25 Aug 2009 01:47:25 -0500 Subject: [PATCH] [NEW] Only 60% top-bias badge for flickr.com. --- Plugin/Plugin.h | 1 + Plugin/Plugin.m | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Plugin/Plugin.h b/Plugin/Plugin.h index 9f0efb5a..54c4fcb8 100755 --- a/Plugin/Plugin.h +++ b/Plugin/Plugin.h @@ -41,6 +41,7 @@ THE SOFTWARE. BOOL mouseInside; BOOL _isLoadingFromWhitelist; BOOL _fromYouTube; + BOOL _fromFlickr; BOOL _embeddedYouTubeView; BOOL _hasH264Version; BOOL _hasHDH264Version; diff --git a/Plugin/Plugin.m b/Plugin/Plugin.m index 8c36d943..750005a8 100755 --- a/Plugin/Plugin.m +++ b/Plugin/Plugin.m @@ -248,7 +248,8 @@ - (id) initWithArguments:(NSDictionary *)arguments } } } - + + _fromFlickr = [[self host] rangeOfString:@"flickr.com"].location != NSNotFound; #if LOGGING_ENABLED NSLog( @"arguments = %@", arguments ); @@ -844,7 +845,7 @@ - (void) _drawBadgeWithPressed: (BOOL) pressed float maxW = NSWidth( bounds ) - kMinMargin; // the 9/10 factor here is to account for the 60% vertical top-biasing - float maxH = NSHeight( bounds )*9/10 - kMinMargin; + float maxH = _fromFlickr ? NSHeight( bounds )*9/10 - kMinMargin : NSHeight( bounds ) - kMinMargin; float minW = kMinHeight * w / h; BOOL rotate = NO; @@ -883,7 +884,11 @@ - (void) _drawBadgeWithPressed: (BOOL) pressed NSAffineTransform* xform = [ NSAffineTransform transform ]; // vertical top-bias by 60% here - [ xform translateXBy: NSWidth( bounds ) / 2 yBy: NSHeight( bounds ) / 10 * 6 ]; + if (_fromFlickr) { + [ xform translateXBy: NSWidth( bounds ) / 2 yBy: NSHeight( bounds ) / 10 * 6 ]; + } else { + [ xform translateXBy: NSWidth( bounds ) / 2 yBy: NSHeight( bounds ) / 2 ]; + } [ xform scaleBy: scaleFactor ]; if( rotate ) [ xform rotateByDegrees: 90 ];