Added an icon to the video results to show the type
This commit is contained in:
parent
7fb0a5bb55
commit
797d6a0fe8
2 changed files with 24 additions and 0 deletions
|
@ -32,6 +32,10 @@ form#video-ctrl {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.video-icon-container {
|
||||||
|
margin-right: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
.video-result.selected {
|
.video-result.selected {
|
||||||
background-color: #c8ffd0 !important;
|
background-color: #c8ffd0 !important;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,10 +14,30 @@ $(document).ready(function() {
|
||||||
.attr('data-url', video['url'])
|
.attr('data-url', video['url'])
|
||||||
.html('title' in video ? video['title'] : video['url']);
|
.html('title' in video ? video['title'] : video['url']);
|
||||||
|
|
||||||
|
var $icon = getVideoIconByUrl(video['url']);
|
||||||
|
$icon.prependTo($videoResult);
|
||||||
$videoResult.appendTo($videoResults);
|
$videoResult.appendTo($videoResults);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var getVideoIconByUrl = function(url) {
|
||||||
|
var $icon = $('<i class="fa"></i>');
|
||||||
|
|
||||||
|
if (url.startsWith('file://')) {
|
||||||
|
$icon.addClass('fa-hdd');
|
||||||
|
} else if (url.startsWith('https://www.youtube.com/')) {
|
||||||
|
$icon.addClass('fa-youtube');
|
||||||
|
} else if (url.startsWith('magnet:?')) {
|
||||||
|
$icon.addClass('fa-wifi');
|
||||||
|
} else {
|
||||||
|
$icon.addClass('fa-video');
|
||||||
|
}
|
||||||
|
|
||||||
|
var $iconContainer = $('<span></span>').addClass('video-icon-container');
|
||||||
|
$icon.appendTo($iconContainer);
|
||||||
|
return $iconContainer;
|
||||||
|
};
|
||||||
|
|
||||||
var initBindings = function() {
|
var initBindings = function() {
|
||||||
$searchForm.on('submit', function(event) {
|
$searchForm.on('submit', function(event) {
|
||||||
var $input = $(this).find('input[name=video-search-text]');
|
var $input = $(this).find('input[name=video-search-text]');
|
||||||
|
|
Loading…
Reference in a new issue