Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
icons
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
icons
Commits
0cfdf73b
Commit
0cfdf73b
authored
Nov 01, 2014
by
William Boman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added tab completion to search input.
parent
3d10e2dc
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
66 additions
and
35 deletions
+66
-35
filter.html
src/_includes/icons/filter.html
+8
-0
base.html
src/_layouts/base.html
+1
-0
flatten_icon_filters.rb
src/_plugins/flatten_icon_filters.rb
+38
-0
site.js
src/assets/js/site.js
+6
-33
tabcomplete.min.js
src/assets/js/tabcomplete.min.js
+6
-0
fontawesome-icon-list.less
src/assets/less/site/fontawesome-icon-list.less
+7
-2
No files found.
src/_includes/icons/filter.html
View file @
0cfdf73b
...
...
@@ -3,6 +3,14 @@
<input
placeholder=
"Filter icons..."
id=
"filter-by"
>
<a
href=
"#"
id=
"filter-clear"
class=
"fa fa-times"
></a>
</div>
<script>
try
{
var
filterSet
=
JSON
.
parse
(
'{{ icons | flattenIconFilters | jsonify }}'
);
}
catch
(
e
)
{
console
.
error
(
'Invalid JSON data!'
);
var
filterSet
=
[];
}
</script>
<
{%
if
page
.
navbar_active =
=
"
icons
"
%}
div
{%
else
%}
section
{%
endif
%}
id=
"filter"
>
<h2
class=
"page-header"
>
Filter for
<span
class=
"text-muted"
id=
"filter-val"
></span></h2>
{% if page.navbar_active != "icons" %}
...
...
src/_layouts/base.html
View file @
0cfdf73b
...
...
@@ -58,6 +58,7 @@
<script
src=
"http://platform.twitter.com/widgets.js"
></script>
<script
src=
"https://ajax.googleapis.com/ajax/libs/jquery/{{ site.jquery.version }}/jquery.min.js"
></script>
<script
src=
"//netdna.bootstrapcdn.com/bootstrap/{{ site.bootstrap.version }}/js/bootstrap.min.js"
></script>
<script
src=
"{{ page.relative_path}}assets/js/tabcomplete.min.js"
></script>
<script
src=
"{{ page.relative_path }}assets/js/site.js"
></script>
</body>
...
...
src/_plugins/flatten_icon_filters.rb
0 → 100644
View file @
0cfdf73b
##
# Flattens the icons object to a one-dimensional array of possible search terms.
require
'set'
module
Jekyll
module
FlattenArray
def
flattenIconFilters
(
icons
)
flattened
=
Set
.
new
icons
.
each
do
|
icon
|
toAdd
=
[]
toAdd
.
push
(
icon
[
"class"
].
downcase
)
# Add class as a filter value
# Add any existing aliases as a filter value
if
not
icon
[
"aliases"
].
nil?
icon
[
"aliases"
].
each
do
|
iconAlias
|
toAdd
.
push
(
iconAlias
.
downcase
)
end
end
# Add any existing filters as a filter value
if
not
icon
[
"filter"
].
nil?
icon
[
"filter"
].
each
do
|
iconFilter
|
toAdd
.
push
(
iconFilter
.
downcase
)
end
end
flattened
.
merge
(
toAdd
)
print
toAdd
if
toAdd
.
include?
true
print
toAdd
if
toAdd
.
include?
false
end
return
flattened
.
to_a
# .to_a because we can't jsonify a <Set>
end
end
end
Liquid
::
Template
.
register_filter
(
Jekyll
::
FlattenArray
)
src/assets/js/site.js
View file @
0cfdf73b
...
...
@@ -16,6 +16,11 @@ $(function() {
var
$icons
=
$
(
'.filter-icon'
,
$filter
);
// Add tab completion
$filter_by
.
tabcomplete
(
filterSet
,
{
arrowKeys
:
true
});
$clear
.
click
(
function
(
e
)
{
e
.
preventDefault
();
$filter_by
.
val
(
''
).
trigger
(
'keyup'
).
focus
();
...
...
@@ -24,7 +29,7 @@ $(function() {
$filter_by
.
keyup
(
function
()
{
var
$this
=
$
(
this
);
var
val
=
$this
.
val
();
var
val
=
$this
.
val
()
.
toLowerCase
()
;
$filter
.
toggle
(
!!
val
);
$other
.
toggle
(
!
val
);
$clear
.
toggleClass
(
'gone'
,
!
val
);
...
...
@@ -61,36 +66,4 @@ $(function() {
}
return
false
;
}
// make code pretty
// $('pre').addClass('prettyprint');
// window.prettyPrint && prettyPrint();
// Disable links with href="#" inside <section>, so users can click on them
// to preview :active state without being scrolled up to the top of the page.
// $('section a[href="#"]').click(function(e) {
// e.preventDefault();
// e.stopPropagation();
// });
// // inject twitter & github counts
// $.ajax({
// url: 'http://api.twitter.com/1/users/show.json',
// data: {screen_name: 'fortaweso_me'},
// dataType: 'jsonp',
// success: function(data) {
// $('#followers').html(data.followers_count);
// }
// });
// $.ajax({
// url: 'https://api.github.com/repos/fortawesome/Font-Awesome',
// dataType: 'jsonp',
// success: function(data) {
// $('#watchers').html(data.data.watchers);
// $('#forks').html(data.data.forks);
// }
// });
});
src/assets/js/tabcomplete.min.js
0 → 100644
View file @
0cfdf73b
/*!
* tabcomplete
* http://github.com/erming/tabcomplete
* v1.4.1
*/
!
function
(
a
){
function
b
(
b
,
c
,
d
){
return
a
.
grep
(
c
,
function
(
a
){
return
d
?
!
a
.
indexOf
(
b
):
!
a
.
toLowerCase
().
indexOf
(
b
.
toLowerCase
())})}
function
c
(
b
){
var
c
=
this
,
d
=
c
.
prev
(
".hint"
);
c
.
css
({
backgroundColor
:
"transparent"
,
position
:
"relative"
}),
d
.
length
||
(
c
.
options
.
wrapInput
&&
c
.
wrap
(
a
(
"<div>"
).
css
({
position
:
"relative"
,
height
:
c
.
css
(
"height"
),
display
:
c
.
css
(
"display"
)})),
d
=
c
.
clone
().
attr
(
"tabindex"
,
-
1
).
removeAttr
(
"id name placeholder"
).
addClass
(
"hint"
).
insertBefore
(
c
),
d
.
css
({
position
:
"absolute"
}));
var
e
=
""
;
if
(
"undefined"
!=
typeof
b
){
var
f
=
c
.
val
();
e
=
f
+
b
.
substr
(
f
.
split
(
/ |
\n
/
).
pop
().
length
)}
d
.
val
(
e
)}
function
d
(
a
){
var
b
=
this
,
c
=
b
.
val
();
a
&&
(
b
.
val
(
c
+
a
.
substr
(
c
.
split
(
/ |
\n
/
).
pop
().
length
)),
b
[
0
].
selectionStart
=
c
.
length
)}
var
e
=
{
backspace
:
8
,
tab
:
9
,
up
:
38
,
down
:
40
};
a
.
tabcomplete
=
{},
a
.
tabcomplete
.
defaultOptions
=
{
after
:
""
,
arrowKeys
:
!
1
,
hint
:
"placeholder"
,
match
:
b
,
caseSensitive
:
!
1
,
minLength
:
1
,
wrapInput
:
!
0
},
a
.
fn
.
tab
=
a
.
fn
.
tabcomplete
=
function
(
b
,
f
){
if
(
this
.
length
>
1
)
return
this
.
each
(
function
(){
a
(
this
).
tabcomplete
(
b
,
f
)});
var
g
=
this
.
prop
(
"tagName"
);
if
(
"INPUT"
==
g
||
"TEXTAREA"
==
g
){
this
.
options
=
f
=
a
.
extend
(
a
.
tabcomplete
.
defaultOptions
,
f
),
this
.
unbind
(
".tabcomplete"
),
this
.
prev
(
".hint"
).
remove
();
var
h
=
this
,
i
=!
1
,
j
=-
1
,
k
=
[],
l
=
""
,
m
=
a
.
noop
;
switch
(
f
.
hint
){
case
"placeholder"
:
m
=
c
;
break
;
case
"select"
:
m
=
d
}
return
this
.
on
(
"input.tabcomplete"
,
function
(){
var
c
=
h
.
val
(),
d
=
c
.
split
(
/ |
\n
/
).
pop
();
j
=-
1
,
l
=
""
,
k
=
[],
h
[
0
].
selectionStart
==
c
.
length
&&
d
.
length
&&
(
k
=
f
.
match
(
d
,
b
,
f
.
caseSensitive
),
f
.
after
&&
(
k
=
a
.
map
(
k
,
function
(
a
){
return
a
+
f
.
after
}))),
h
.
trigger
(
"match"
,
k
.
length
),
f
.
hint
&&
((
"select"
!=
f
.
hint
||!
i
)
&&
d
.
length
>=
f
.
minLength
?
m
.
call
(
h
,
k
[
0
]):
m
.
call
(
h
,
""
)),
i
&&
(
i
=!
1
)}),
this
.
on
(
"keydown.tabcomplete"
,
function
(
a
){
var
b
=
a
.
which
;
if
(
b
==
e
.
tab
||
f
.
arrowKeys
&&
(
b
==
e
.
up
||
b
==
e
.
down
)){
if
(
a
.
preventDefault
(),
b
!=
e
.
up
)
j
++
;
else
{
if
(
-
1
==
j
)
return
;
0
==
j
?
j
=
k
.
length
-
1
:
j
--
}
var
c
=
k
[
j
%
k
.
length
];
if
(
!
c
)
return
;
var
d
=
h
.
val
();
if
(
l
=
l
||
d
.
split
(
/ |
\n
/
).
pop
(),
l
.
length
<
f
.
minLength
)
return
;
var
g
=
"select"
==
f
.
hint
?
d
:
d
.
substr
(
0
,
h
[
0
].
selectionStart
-
l
.
length
)
+
c
;
h
.
val
(
g
),
"select"
==
f
.
hint
&&
(
h
[
0
].
selectionStart
=
g
.
length
),
l
=
c
,
h
.
trigger
(
"tabcomplete"
,
l
),
f
.
hint
&&
m
.
call
(
h
,
""
)}
else
a
.
which
==
e
.
backspace
&&
(
i
=!
0
,
j
=-
1
,
l
=
""
)}),
f
.
hint
&&
m
.
call
(
this
,
""
),
this
}}}(
jQuery
);
\ No newline at end of file
src/assets/less/site/fontawesome-icon-list.less
View file @
0cfdf73b
...
...
@@ -33,14 +33,19 @@
.filter-parent {
display: inline-block;
position: relative;
border: 1px solid #ccc;
padding: 0 10px 0 14px;
border-radius: 3px;
#filter-by {
#filter-by
, .hint
{
padding: 7px 0 7px 12px;
border: 0 none;
outline: 0 none;
width: 200px;
width: 300px;
z-index: 2;
}
.hint {
color: #aaa;
}
a {
text-decoration: none;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment