Last active
March 11, 2019 14:36
-
-
Save Rayer/944f50058fd4ca7f5208991d6f5dd3bc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSArray* searchImageSuffix = @[@".jpg", @".jpeg", @".gif", @".tiff", @".png"]; | |
if ([shortURL hasPrefix: @"sm"] && [shortURL length] <= 10 && isAllDigit([shortURL substringFromIndex: 2])) { | |
addShortenedURLMenuItem([@"NicoNico/" stringByAppendingString: shortURL], | |
[@"http://www.nicovideo.jp/watch/" stringByAppendingString: shortURL]); | |
} else if ([shortURL hasPrefix: @"id="] && [shortURL length] <= 12 && isAllDigit([shortURL substringFromIndex: 3])) { | |
addShortenedURLMenuItem([@"pixiv_illust/" stringByAppendingString: shortURL], | |
[@"http://www.pixiv.net/member_illust.php?mode=medium&illust_" stringByAppendingString: shortURL]); | |
} else if ([shortURL hasPrefix: @"mid="] && [shortURL length] <= 12 && isAllDigit([shortURL substringFromIndex: 4])) { | |
addShortenedURLMenuItem([@"pixiv_member/" stringByAppendingString: [shortURL substringFromIndex: 4]], | |
[@"http://www.pixiv.net/member.php?id=" stringByAppendingString: [shortURL substringFromIndex: 4]]); | |
} else if (^(NSArray* searchImageSuffix) { | |
for(NSString* suffix in searchImageSuffix) { | |
if([shortURL hasSuffix:suffix]) | |
return TRUE; | |
} | |
return FALSE; | |
}(searchImageSuffix)) | |
{ | |
addShortenedURLMenuItem(@"Image search by GOOGLE", [@"https://www.google.com/searchbyimage?&image_url=" stringByAppendingString: shortURL]); | |
} else if ([shortURL length] == 4) { | |
addShortenedURLMenuItem([@"ppt.cc/" stringByAppendingString: shortURL], | |
[@"http://ppt.cc/" stringByAppendingString: shortURL]); | |
} else if ([shortURL length] == 5) { | |
addShortenedURLMenuItem([@"0rz.tw/" stringByAppendingString: shortURL], | |
[@"http://0rz.tw/" stringByAppendingString: shortURL]); | |
} else if ([shortURL length] == 6 || [shortURL length] == 7) { | |
addShortenedURLMenuItem([@"tinyurl.com/" stringByAppendingString: shortURL], | |
[@"http://tinyurl.com/" stringByAppendingString: shortURL]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment