Skip to content

Commit 4cb5ec4

Browse files
committed
Correct format
1 parent 6b8c8e2 commit 4cb5ec4

File tree

6 files changed

+495
-5
lines changed

6 files changed

+495
-5
lines changed

assets/data.json

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
[
2+
{
3+
"id": 1,
4+
"name": "Kenneth Auchenberg",
5+
"avatar": "http://cdn0.4dots.com/i/customavatars/avatar7112_1.gif",
6+
"type": "contact"
7+
},
8+
{
9+
"id": 2,
10+
"name": "Jon Froda",
11+
"avatar": "http://cdn0.4dots.com/i/customavatars/avatar7112_1.gif",
12+
"type": "contact"
13+
},
14+
{
15+
"id": 3,
16+
"name": "Anders Pollas",
17+
"avatar": "http://cdn0.4dots.com/i/customavatars/avatar7112_1.gif",
18+
"type": "contact"
19+
},
20+
{
21+
"id": 4,
22+
"name": "Kasper Hulthin",
23+
"avatar": "http://cdn0.4dots.com/i/customavatars/avatar7112_1.gif",
24+
"type": "contact"
25+
},
26+
{
27+
"id": 5,
28+
"name": "Andreas Haugstrup",
29+
"avatar": "http://cdn0.4dots.com/i/customavatars/avatar7112_1.gif",
30+
"type": "contact"
31+
},
32+
{
33+
"id": 6,
34+
"name": "Pete Lacey",
35+
"avatar": "http://cdn0.4dots.com/i/customavatars/avatar7112_1.gif",
36+
"type": "contact"
37+
},
38+
{
39+
"id": 7,
40+
"name": "[email protected]",
41+
"avatar": "http://cdn0.4dots.com/i/customavatars/avatar7112_1.gif",
42+
"type": "contact"
43+
}
44+
]

assets/example2.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
$(function () {
2+
3+
$('textarea.mention-example2').mentionsInput({
4+
onDataRequest:function (mode, query, callback) {
5+
$.getJSON('assets/data.json', function(responseData) {
6+
responseData = _.filter(responseData, function(item) { return item.name.toLowerCase().indexOf(query.toLowerCase()) > -1 });
7+
callback.call(this, responseData);
8+
});
9+
}
10+
11+
});
12+
13+
});

assets/examples.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
$(function () {
2+
3+
$('textarea.mention').mentionsInput({
4+
onDataRequest:function (mode, query, callback) {
5+
var data = [
6+
{ id:1, name:'Kenneth Auchenberg', 'avatar':'http://cdn0.4dots.com/i/customavatars/avatar7112_1.gif', 'type':'contact' },
7+
{ id:2, name:'Jon Froda', 'avatar':'http://cdn0.4dots.com/i/customavatars/avatar7112_1.gif', 'type':'contact' },
8+
{ id:3, name:'Anders Pollas', 'avatar':'http://cdn0.4dots.com/i/customavatars/avatar7112_1.gif', 'type':'contact' },
9+
{ id:4, name:'Kasper Hulthin', 'avatar':'http://cdn0.4dots.com/i/customavatars/avatar7112_1.gif', 'type':'contact' },
10+
{ id:5, name:'Andreas Haugstrup', 'avatar':'http://cdn0.4dots.com/i/customavatars/avatar7112_1.gif', 'type':'contact' },
11+
{ id:6, name:'Pete Lacey', 'avatar':'http://cdn0.4dots.com/i/customavatars/avatar7112_1.gif', 'type':'contact' },
12+
{ id:7, name:'[email protected]', 'avatar':'http://cdn0.4dots.com/i/customavatars/avatar7112_1.gif', 'type':'contact' },
13+
{ id:8, name:'Pete Awesome Lacey', 'avatar':'http://cdn0.4dots.com/i/customavatars/avatar7112_1.gif', 'type':'contact' },
14+
{ id:9, name:'Kenneth Hulthin', 'avatar':'http://cdn0.4dots.com/i/customavatars/avatar7112_1.gif', 'type':'contact' }
15+
];
16+
17+
data = _.filter(data, function(item) { return item.name.toLowerCase().indexOf(query.toLowerCase()) > -1 });
18+
19+
callback.call(this, data);
20+
},
21+
allowRepeat: true
22+
});
23+
24+
$('.get-syntax-text').click(function() {
25+
$('textarea.mention').mentionsInput('val', function(text) {
26+
alert(text);
27+
});
28+
});
29+
30+
$('.get-mentions').click(function() {
31+
$('textarea.mention').mentionsInput('getMentions', function(data) {
32+
alert(JSON.stringify(data));
33+
});
34+
}) ;
35+
36+
});

assets/style.css

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
body {
2+
background: #f6f6f6;
3+
color: #192535;
4+
font-family: 'pt sans', arial, helvetica, sans-serif;
5+
font-size: 16px;
6+
margin: 0;
7+
padding: 0;
8+
}
9+
10+
div.container {
11+
font-size: 16px;
12+
width: 720px;
13+
padding: 50px 0 50px 50px;
14+
}
15+
16+
div.container > p,
17+
div.container > li,
18+
div.container > ol {
19+
margin: 16px 0 16px 0;
20+
width: 550px;
21+
}
22+
23+
div.examples {
24+
width: 560px;
25+
}
26+
27+
.examples .mentions-input-box {
28+
margin-bottom: 10px;
29+
font-size: 14px;
30+
}
31+
32+
.examples .mentions-input-box textarea {
33+
font-family: 'pt sans', arial, helvetica, sans-serif;
34+
font-size: 14px;
35+
}
36+
37+
38+
a, a:visited {
39+
padding: 0 2px;
40+
text-decoration: none;
41+
background: #eee;
42+
color: #00639e;
43+
}
44+
45+
a:active, a:hover {
46+
color: #000;
47+
background: #bacada;
48+
}
49+
50+
h1, h2, h3, h4, h5, h6 {
51+
margin-top: 40px;
52+
font-weight: normal;
53+
}
54+
55+
h1 {
56+
font-size: 56px;
57+
}
58+
59+
h2 {
60+
font-size: 24px;
61+
}
62+
63+
b.header {
64+
font-size: 18px;
65+
}
66+
67+
span.alias {
68+
font-size: 14px;
69+
font-style: italic;
70+
margin-left: 20px;
71+
}
72+
73+
table {
74+
margin: 16px 0;
75+
padding: 0;
76+
}
77+
78+
tr, td {
79+
margin: 0;
80+
padding: 0;
81+
vertical-align: top;
82+
}
83+
84+
td {
85+
padding: 9px 15px 9px 0;
86+
}
87+
88+
td.definition {
89+
line-height: 18px;
90+
font-size: 14px;
91+
}
92+
93+
code, pre, tt {
94+
font-family: Monaco, Consolas, "Lucida Console", monospace;
95+
font-size: 12px;
96+
line-height: 18px;
97+
color: #294555;
98+
}
99+
100+
code {
101+
margin-left: 20px;
102+
}
103+
104+
pre {
105+
font-size: 12px;
106+
padding: 2px 0 2px 12px;
107+
border-left: 6px solid #99aabb;
108+
margin: 0px 0 30px;
109+
}
110+
111+
.button {
112+
display: inline-block;
113+
line-height: 24px;
114+
margin-bottom: 4px;
115+
font-weight: normal;
116+
text-shadow: none;
117+
padding: 1px 10px 1px 10px;
118+
white-space: nowrap;
119+
cursor: pointer;
120+
121+
border-radius: 5px;
122+
123+
background: #eaeaea;
124+
background: -moz-linear-gradient(top, hsl(0, 0%, 96%), #eaeaea);
125+
background: -webkit-gradient(linear, left top, left bottom, from(#f6f6f6), to(#eaeaea));
126+
border: 1px solid #dcdcdc;
127+
color: #525252;
128+
}

0 commit comments

Comments
 (0)