Skip to content

Commit 65e0762

Browse files
committed
[NEW] Only 60% top-bias badge for flickr.com.
1 parent 00a3911 commit 65e0762

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

Plugin/Plugin.h

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ THE SOFTWARE.
4141
BOOL mouseInside;
4242
BOOL _isLoadingFromWhitelist;
4343
BOOL _fromYouTube;
44+
BOOL _fromFlickr;
4445
BOOL _embeddedYouTubeView;
4546
BOOL _hasH264Version;
4647
BOOL _hasHDH264Version;

Plugin/Plugin.m

+8-3
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,8 @@ - (id) initWithArguments:(NSDictionary *)arguments
248248
}
249249
}
250250
}
251-
251+
252+
_fromFlickr = [[self host] rangeOfString:@"flickr.com"].location != NSNotFound;
252253

253254
#if LOGGING_ENABLED
254255
NSLog( @"arguments = %@", arguments );
@@ -844,7 +845,7 @@ - (void) _drawBadgeWithPressed: (BOOL) pressed
844845

845846
float maxW = NSWidth( bounds ) - kMinMargin;
846847
// the 9/10 factor here is to account for the 60% vertical top-biasing
847-
float maxH = NSHeight( bounds )*9/10 - kMinMargin;
848+
float maxH = _fromFlickr ? NSHeight( bounds )*9/10 - kMinMargin : NSHeight( bounds ) - kMinMargin;
848849
float minW = kMinHeight * w / h;
849850

850851
BOOL rotate = NO;
@@ -883,7 +884,11 @@ - (void) _drawBadgeWithPressed: (BOOL) pressed
883884

884885
NSAffineTransform* xform = [ NSAffineTransform transform ];
885886
// vertical top-bias by 60% here
886-
[ xform translateXBy: NSWidth( bounds ) / 2 yBy: NSHeight( bounds ) / 10 * 6 ];
887+
if (_fromFlickr) {
888+
[ xform translateXBy: NSWidth( bounds ) / 2 yBy: NSHeight( bounds ) / 10 * 6 ];
889+
} else {
890+
[ xform translateXBy: NSWidth( bounds ) / 2 yBy: NSHeight( bounds ) / 2 ];
891+
}
887892
[ xform scaleBy: scaleFactor ];
888893
if( rotate )
889894
[ xform rotateByDegrees: 90 ];

0 commit comments

Comments
 (0)