Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
90 lines (83 loc) · 3.28 KB

File metadata and controls

90 lines (83 loc) · 3.28 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
//
// CodingTip.m
// Coding_iOS
//
// Created by 王 原闯 on 14-9-2.
// Copyright (c) 2014年 Coding. All rights reserved.
//
#import "CodingTip.h"
#import "Login.h"
@implementation CodingTip
- (void)setContent:(NSString *)content{
if (_content != content) {
_htmlMedia = [HtmlMedia htmlMediaWithString:content showType:MediaShowTypeImageAndMonkey];
_content = _htmlMedia.contentDisplay;
}
if (_target_type.length > 0) {
[self adjust];
}
}
- (void)setTarget_type:(NSString *)target_type{
_target_type = target_type;
if (_content.length > 0) {
[self adjust];
}
}
- (void)adjust{
//根据 content、target_type 去重组数据
if ([_target_type isEqualToString:@"Depot"]) {//您导入的仓库(xxx)成功。点击查看:<a>playmore</a>
_user_item = [HtmlMediaItem htmlMediaItemWithTypeATUser:[Login curLoginUser] mediaRange:NSMakeRange(0, 0)];
}else if (_htmlMedia.mediaItems.count > 0) {
_user_item = [_htmlMedia.mediaItems firstObject];
[_htmlMedia removeItem:_user_item];
}
if (_htmlMedia.mediaItems.count > 0) {
_target_item = [_htmlMedia.mediaItems lastObject];
[_htmlMedia removeItem:_target_item];
}
_target_type_ColorName = [[CodingTip p_color_dict] objectForKey:_target_type];
if (_target_type_ColorName.length <= 0) {
_target_type_ColorName = @"0x379FD3";
}
_target_type_imageName = [NSString stringWithFormat:@"tipIcon_%@", _target_type];
NSRange range = [_htmlMedia.contentDisplay rangeByTrimmingLeftCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
if (range.location > 0) {
for (HtmlMediaItem *item in _htmlMedia.mediaItems) {
item.range = NSMakeRange(item.range.location - range.location, item.range.length);
}
[_htmlMedia.contentDisplay deleteCharactersInRange:NSMakeRange(0, range.location)];
}
_content = _htmlMedia.contentDisplay;
}
+ (NSDictionary *)p_color_dict{
static NSDictionary *color_dict = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
color_dict = @{
@"BranchMember" : @"0x1AB6D9",
@"CommitLineNote" : @"",
@"Depot" : @"",
@"MergeRequestBean" : @"0x4E74B7",
@"MergeRequestComment" : @"0x4E74B7",
@"Project" : @"0xF8BE46",
@"ProjectFileComment" : @"",
@"ProjectMember" : @"0x1AB6D9",
@"ProjectPayment" : @"",
@"ProjectTopic" : @"0x2FAEEA",
@"ProjectTweet" : @"0xFB8638",
@"ProjectTweetComment" : @"0xFB8638",
@"PullRequestBean" : @"0x49C9A7",
@"PullRequestComment" : @"0x49C9A7",
@"QcTask" : @"0x3C8CEA",
@"Task" : @"0x379FD3",
@"TaskComment" : @"0x379FD3",
@"Tweet" : @"0xFB8638",
@"TweetComment" : @"0xFB8638",
@"TweetLike" : @"0xFF5847",
@"User" : @"0x496AB3",
@"UserFollow" : @"0x3BBD79",
};
});
return color_dict;
}
@end
Morty Proxy This is a proxified and sanitized view of the page, visit original site.