Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
cu-links/homepage.html
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
179 lines (121 sloc)
5.99 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="description" content="My Bookmarks"> | |
<meta name="keywords" content="HTML, CSS, JavaScript"> | |
<meta name="author" content="Alex Pedcenko"> | |
<link href='https://fonts.googleapis.com/css?family=Raleway' rel='stylesheet' type='text/css'> | |
<link rel="stylesheet" href="https://home.coventry.domains/style.css"> | |
<script type="text/javascript" src="./icons.js"> | |
//all data is there in icons.js | |
</script> | |
<script> | |
N = icons.length; // take in all icons in the array icons[] | |
// N = 12; // OR you can limit it to first 12 by saying e.g. N = 12; | |
if(navigator.userAgent.match(/iPad/i)){ | |
document.write('<meta name="viewport" content="width=device-width, content="initial-scale=1" >'); | |
}else{ | |
document.write('<meta name="viewport" content="initial-scale=0.6, width=device-width" >'); | |
} | |
</script> | |
</head> | |
<body> | |
<div class='bodydiv'> | |
<div class="empty"></div> | |
<form method="GET" action="https://www.google.com/search" target="_blank" class='toprow' > | |
<input type="button" onclick="{window.open('https://github.coventry.ac.uk/aa3025/cu-links/','_blank'); };" value="⚙" title='Customise'/> | |
<input type="button" onclick="location.href='?showgroups=no';" value="▢" title='Default order'/> | |
<input type="button" onclick="location.href='?showgroups=yes';" value="▢▢▢️" title='Groups' /> | |
<input type="button" onclick="location.href='?order=az';" value="⇩" title='Sort A to Z' /> | |
<input type="button" onclick="location.href='?order=za';" value="⇧" title='Sort Z to A'/> | |
Search: <input name="q" type="text" size=30> | |
<input type="submit" class='google' value=" " formaction="https://www.google.com/search" target="_blank" title='Search with Google'> | |
<input type="submit" class='duck' value=" " formaction="https://duckduckgo.com/" target="_blank" title='Search with DuckDuckGo'> | |
</form> | |
<center> | |
<div class="maintable" id="maintable"></div> | |
</center> | |
<div class="footer" width=100%></div><br> | |
<center><div class='footer'><a href='https://github.coventry.ac.uk/aa3025/cu-links/' target='_blank'>How to customise</a></div></center> | |
</div> | |
<script> | |
let table = document.getElementById("maintable"); | |
j=0; | |
const queryString = window.location.search; | |
const urlParams = new URLSearchParams(queryString); | |
const order = urlParams.get('order'); | |
var showgroups = urlParams.get('showgroups'); | |
if (showgroups == null) { | |
showgroups = 'yes'; | |
} | |
if (order == "az"){ | |
icons.sort(); | |
} else if (order == "za"){ | |
icons.sort((a, b) => (a[0] > b[0] ? -1 : 1)); | |
}else{ | |
} | |
var column4 = icons.map(function(value,index) { return value[3]; }); | |
nonempty_groups=column4.filter(n => n); | |
nongroup_entries = N - nonempty_groups.length; //how many cons have GROUP = ''; | |
allgroups = nonempty_groups.filter(onlyUnique); // unique groups | |
G = allgroups.length; // how many unoque nonempty groups | |
if (G > 0 && showgroups === 'yes'){ // ********** show group tabs | |
allgroups.sort(); // sort groups a...z | |
for(var g=0;g<G;g++){ //loop along all unique groups | |
const group = document.createElement('div'); | |
group.classList.add('groups'); | |
const grp_title = document.createElement('div'); | |
grp_title.classList.add('groupcaption'); | |
grp_title.innerHTML = "<div class='groupcaptiontext'>" + allgroups[g] + "</div>"; | |
table.append(grp_title); | |
table.append(group); | |
for(var i=0;i<N;i++){ // i-th row from icons[] | |
if (icons[i][3] == allgroups[g]) { | |
cell = document.createElement("div"); | |
cell.classList.add('tiles'); | |
//cell.setAttribute('id', 'tiles') | |
cell.innerHTML = "<div class='innertile'><a href='" + icons[i][1] + "' target='_blank'><img class='icons' src='" + icons[i][2] + "' /><span class='caption'><br>" + icons[i][0] + "</span></a></div>"; | |
group.append(cell); //append tile to group g | |
} | |
} | |
} // grp loop ends | |
} else { // *************** if we have no groups defined in icons.js or showgroups=no **************** | |
const group = document.createElement('div'); | |
group.classList.add('no_tab_group'); | |
/*const grp_title = document.createElement('div'); /* no need ofr a tab here */ | |
/* grp_title.classList.add('groupcaption_invisivle'); | |
grp_title.innerHTML = ' All Links '; | |
table.append(grp_title); */ | |
table.append(group); | |
for(var i=0;i<N;i++){ // i-th row from icons[] | |
cell = document.createElement("div"); | |
cell.classList.add('tiles'); | |
//cell.setAttribute('id', 'tile_' + i); | |
cell.innerHTML = "<div class='innertile'><a href='" + icons[i][1] + "' target='_blank'><img class='icons' src='" + icons[i][2] + "' /></a><span class='caption'><br>" + icons[i][0] + "</span></div>"; | |
group.append(cell); | |
} | |
} | |
if (nongroup_entries > 0 && showgroups === 'yes'){ // picking up all icons without groups | |
const group = document.createElement('div'); | |
group.classList.add('groups'); | |
const grp_title = document.createElement('div'); | |
grp_title.classList.add('groupcaption'); | |
grp_title.innerHTML = "<div class='groupcaptiontext'>" + "Other Links" + "</div>" | |
table.append(grp_title); | |
table.append(group); | |
for(var i=0;i<N;i++){ // i-th row from icons[] | |
if (! icons[i][3]) { | |
cell = document.createElement("div"); | |
cell.classList.add('tiles'); | |
//cell.setAttribute('id', 'tiles') | |
cell.innerHTML = "<div class='innertile'><a href='" + icons[i][1] + "' target='_blank'><img class='icons' src='" + icons[i][2] + "' /></a><span class='caption'><br>" + icons[i][0] + "</span></div>"; | |
group.append(cell); | |
} | |
} | |
} | |
function onlyUnique(value, index, array) { //filter unique entries only | |
return array.indexOf(value) === index; | |
} | |
</script> | |
</body> | |
</html> |