VertiBar/examples/basic_example.html

115 lines
2.8 KiB
HTML
Raw Normal View History

2018-07-22 00:29:20 +03:00
<html>
<head>
<title>Speed Dial</title>
<link rel="icon" href="https://pube.tk/favicon.ico" type="image/x-icon" />
<script>
/* Configuration */
var sortSubcategories = true; // Sort URLs alphabetically
var singleExpand = true; // Allow expanding one category at a time
var sites = // JSON tree structure of 'Group' : { 'Name' : 'URL' }
{
'Shopping' :
{
'eBay' : 'https://www.ebay.com/',
'Amazon' : 'https://www.amazon.com/',
},
'Search' :
{
'DuckDuckGo' : 'https://duckduckgo.com/',
'Qwant' : 'https://www.qwant.com/',
},
'Entertainment':
{
'asdf' : 'http://asdf.com/',
},
'Videos':
{
'HookTube' : 'http://hooktube.com',
}
};
</script>
<style>
body {
background-color: #151515;
color: #bbb;
font-family: Arial;
-moz-user-select: -moz-none;
-khtml-user-select: none;
-webkit-user-select: none;
}
a {
color: #BB7D38;
text-decoration: none;
display:block;
}
a:hover {
color: #FF8500;
}
.hidden {
display: none;
}
.navBlock {
display: inline-block;
vertical-align: middle;
}
.expandLink {
font-weight: bold;
}
.hidden > a {
color: #bbb;
}
#mainNav {
margin: auto;
text-align: center;
position: relative;
top: 50%;
transform: translateY(-50%);
display: none;
}
</style>
<script src="http://code.jquery.com/jquery-3.2.1.min.js"></script> <!-- Gets cached, can be replaced with Google hosted library -->
<script>
$(document).ready(function(){
// Subcategory sort
if(sortSubcategories)
{
jQuery.each(sites, function(group, values) {
unordered = this;
const ordered = {};
Object.keys(unordered).sort().forEach(function(key) {
ordered[key] = unordered[key];
});
sites[group] = ordered;
});
}
// Navigation menu
jQuery.each(sites, function(group, values) {
urlStr = "";
jQuery.each(values, function(name, url) {
urlStr += '<a href="'+url+'">'+name+'</a>';
});
if($('#mainNav').children().length) {
$('#mainNav').append(' :: ');
}
$('#mainNav').append('<div class="navBlock"><a href="#" class="expandLink">'+group+'</a><div class="hidden">'+urlStr+'</div></div>');
});
$("#mainNav").fadeIn();
// Subcategory URL expansion
$('.expandLink').bind('click', function () {
if(singleExpand && $(this).siblings().is(":hidden"))
$('.expandLink').siblings().slideUp(); // "Closes" all categories
$(this).siblings().slideToggle(200);
});
});
</script>
2020-05-08 20:04:55 +03:00
<meta name="Abhorrent_Anger" content="Speed Dial">
2018-07-22 00:29:20 +03:00
<meta http-equiv="Cache-control" content="public">
</head>
<body bgcolor="#151515">
<div id="mainNav">
</div>
</body>
</html>