narrow window conf
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
config.source="example_links.txt";
|
||||
config.columns=3;
|
||||
config.narrow=500; // less than N pixels window results in single column
|
||||
config.title="MDLinks";
|
||||
config.favicon=null; // link to favicon
|
||||
config.css=null; // link to style file
|
||||
|
||||
@@ -57,6 +57,9 @@ function init() {
|
||||
hitList=search_hits(document.getElementById("filter").value);
|
||||
print_results(hitList);
|
||||
}
|
||||
function narrow_window() {
|
||||
return window.innerWidth < config.narrow;
|
||||
}
|
||||
String.prototype.capitalizeFirstLetter = function() {
|
||||
return this.charAt(0).toUpperCase() + this.slice(1);
|
||||
}
|
||||
@@ -134,7 +137,7 @@ function print_results(hitList) {
|
||||
var cat=0;
|
||||
for (c=0; c<linkList.length; c++) {
|
||||
if ( linkList[c].substring(0,2) == "# " ) {
|
||||
if (cat%config.columns==0) { tbody.innerHTML+="<tr>"; }
|
||||
if (cat%config.columns==0 || narrow_window()) { tbody.innerHTML+="<tr>"; }
|
||||
var td=document.createElement("td");
|
||||
td.innerHTML+=make_head(linkList[c]);
|
||||
tbody.appendChild(td);
|
||||
@@ -206,7 +209,8 @@ var config = {
|
||||
search:true, // include search bar
|
||||
columns:4, // number of columns for link table
|
||||
style:null, // file to load css from
|
||||
favicon:null // link to favicon file
|
||||
favicon:null, // link to favicon file
|
||||
narrow:600 // pixel width that is narrow screen = single column table
|
||||
};
|
||||
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user