new stuff
This commit is contained in:
@@ -40,3 +40,19 @@ are parsed.
|
||||
[Source file](example_links.txt)
|
||||
[Additional config](config.js)
|
||||
[Project homepage](https://bitbucket.org/MoonQ/mdlinks)
|
||||
|
||||
# Advanced
|
||||
## Parsing the request
|
||||
|
||||
[Open pages in new window](?blank)
|
||||
[Predefined filter](?filter=predefined)
|
||||
|
||||
## Keyboard
|
||||
|
||||
- N: toggle new window opening
|
||||
- C: clear filter
|
||||
- S: enter filter editor
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
25
index.html
25
index.html
@@ -80,6 +80,7 @@ function init() {
|
||||
print_results(hitList);
|
||||
fold_initial();
|
||||
scroll_load();
|
||||
parse_request();
|
||||
}
|
||||
function narrow_window() {
|
||||
return window.innerWidth < config.narrow;
|
||||
@@ -141,6 +142,7 @@ function filter(ev) {
|
||||
var c=hitList.length;
|
||||
var lastHit=hitList[c-1];
|
||||
print_results(hitList);
|
||||
if (ev == null) { return }
|
||||
var key=ev.keyCode;
|
||||
if (key==13){
|
||||
if (c==0) { document.getElementById('filter').focus(); }
|
||||
@@ -273,6 +275,23 @@ function parse_links(s) {
|
||||
linkList=links.slice(0);
|
||||
init();
|
||||
}
|
||||
|
||||
function parse_request() {
|
||||
var request = window.location.search.substring(1);
|
||||
var vars = request.split('&');
|
||||
for (var i = 0; i < vars.length; i++) {
|
||||
var pair = vars[i].split('=');
|
||||
if (decodeURIComponent(pair[0]) == "blank") {
|
||||
toggle_blank();
|
||||
}
|
||||
if (decodeURIComponent(pair[0]) == "filter") {
|
||||
var value = decodeURIComponent(pair[1]);
|
||||
document.getElementById("filter").value = value;
|
||||
filter(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function keyboard_entry(ev) {
|
||||
var kC = ev.keyCode;
|
||||
var k = String.fromCharCode(ev.keyCode);
|
||||
@@ -300,7 +319,7 @@ function toggle_blank() {
|
||||
span.attributes['data'] = "true";
|
||||
}
|
||||
} else {
|
||||
span.attributes['data']="true"
|
||||
span.attributes['data'] = "true";
|
||||
}
|
||||
var blank=span.attributes['data']=="true";
|
||||
var anchors = document.getElementsByTagName('a');
|
||||
@@ -421,9 +440,9 @@ function fold_set_state(state) {
|
||||
}
|
||||
|
||||
function set_cookie(name,value) {
|
||||
// Save cookies for 2 hours
|
||||
// Save cookies for 30 minutes
|
||||
document.cookie = name + "=" + value.toString() + "&" + window.location.pathname +
|
||||
";path=" + window.location.pathname + ";max-age="+ (60*60*2).toString() + ";";
|
||||
";path=" + window.location.pathname + ";max-age="+ (60 * 30).toString() + ";";
|
||||
}
|
||||
|
||||
function clear() {
|
||||
|
||||
Reference in New Issue
Block a user