1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-03-04 20:35:47 +01:00

minor refactoring of "gu" action

This commit is contained in:
Doug Kearns
2008-12-10 02:31:31 +11:00
parent ce8d5c369e
commit 2bd177b471

View File

@@ -233,21 +233,20 @@ const config = { //{{{
{ {
if (/^file:\/|^\//.test(url)) if (/^file:\/|^\//.test(url))
{ {
//var strippedFilename = url.replace(/^(file:\/\/)?(.*)/, "$2"); let file = io.getFile(url);
var file = io.getFile(url); return file.exists() && file.isDirectory();
if (!file.exists() || !file.isDirectory()) }
return false; else
else {
return true; // for all other locations just check if the URL ends with /
return /\/$/.test(url);
} }
// for all other locations just check if the URL ends with /
return /\/$/.test(url);
} }
if (count < 1) if (count < 1)
count = 1; count = 1;
// XXX
var url = buffer.URL; var url = buffer.URL;
for (let i = 0; i < count; i++) for (let i = 0; i < count; i++)
{ {
@@ -259,11 +258,9 @@ const config = { //{{{
url = url.replace(/^(.*:\/+.*?)\/+$/, "$1/"); // get rid of more than 1 / at the end url = url.replace(/^(.*:\/+.*?)\/+$/, "$1/"); // get rid of more than 1 / at the end
if (url == buffer.URL) if (url == buffer.URL)
{
liberator.beep(); liberator.beep();
return; else
} liberator.open(url);
liberator.open(url);
}, },
{ flags: Mappings.flags.COUNT }); { flags: Mappings.flags.COUNT });