mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-21 10:27:59 +01:00
fixed gu and gU
This commit is contained in:
6
Makefile
6
Makefile
@@ -97,7 +97,7 @@ release: ${XPI} ${RDF}
|
||||
${RDF}: ${RDF_IN} Makefile
|
||||
@echo "Preparing release..."
|
||||
${Q}${SED} -e "s,###VERSION###,${VERSION},g" \
|
||||
-e "s,###DATE###,${DATE},g" \
|
||||
-e "s,###DATE###,${BUILD_DATE},g" \
|
||||
< $< > $@
|
||||
@echo "SUCCESS: $@"
|
||||
|
||||
@@ -120,7 +120,7 @@ ${XPI}: ${BUILD_XPI_SUBDIRS} ${XPI_FILES}
|
||||
done
|
||||
${Q}for f in ${XPI_TXT_FILES} ; do \
|
||||
${SED} -e "s,###VERSION###,${VERSION},g" \
|
||||
-e "s,###DATE###,${DATE},g" \
|
||||
-e "s,###DATE###,${BUILD_DATE},g" \
|
||||
< $$f > ${BUILD_XPI_DIR}/$$f ; \
|
||||
( diff -q $$f ${BUILD_XPI_DIR}/$$f 1>/dev/null ) || \
|
||||
( echo "modified: $$f" ; \
|
||||
@@ -138,7 +138,7 @@ ${JAR}: ${BUILD_JAR_SUBDIRS} ${JAR_FILES}
|
||||
@echo "Building JAR..."
|
||||
${Q}for f in ${JAR_FILES} ; do \
|
||||
${SED} -e "s,###VERSION###,${VERSION},g" \
|
||||
-e "s,###DATE###,${DATE},g" \
|
||||
-e "s,###DATE###,${BUILD_DATE},g" \
|
||||
< $$f > ${BUILD_JAR_DIR}/$$f ; \
|
||||
( diff -q $$f ${BUILD_JAR_DIR}/$$f 1>/dev/null ) || \
|
||||
( echo "modified: $$f" ; \
|
||||
|
||||
@@ -81,14 +81,15 @@ var g_commands = [/*{{{*/
|
||||
],
|
||||
[
|
||||
["bmadd"],
|
||||
["bmadd [-tT] [url]"],
|
||||
["bmadd [-tTk] [url]"],
|
||||
"Add a bookmark",
|
||||
"If you don't add a custom title, either the title of the webpage or the URL will be taken as the title.<br/>" +
|
||||
"Tags WILL be some mechanism to classify bookmarks. Assume, you tag a url with the tags \"linux\" and \"computer\" you'll be able to search for bookmarks containing these tags.<br/>" +
|
||||
"You can omit the optional [url] field, so just do <code>:bmadd</code> to bookmark the currently loaded web page with a default title and without any tags.<br/>" +
|
||||
"The following options WILL be interpretted in the future:<br/>" +
|
||||
" -t 'custom title'<br/>" +
|
||||
" -T comma,separated,tag,list <br/>",
|
||||
" -t \"custom title\"<br/>" +
|
||||
"The following options will be interpreted in the future:<br/>" +
|
||||
" -T comma,separated,tag,list <br/>"+
|
||||
" -k keyword <br/>",
|
||||
bmadd,
|
||||
null
|
||||
],
|
||||
@@ -239,9 +240,9 @@ var g_commands = [/*{{{*/
|
||||
"Multiple URLs can be separated with the | character.<br/>" +
|
||||
"Each |-separated token is analayzed and in this order:<br/>"+
|
||||
"<ol><li>Opened with the specified search engine if the token looks like a search string and the first word of the token is the name of a search engine (<code class=command>:open wiki linus torvalds</code> will open the wikipedia entry for linux torvalds).</li>"+
|
||||
" <li>Transformed to a relative URL of the current location if it starts with . or .. or ...;<br/>... is special and goes to the moves up the directory hierarchy as far as possible.<br/>"+
|
||||
" <code class=command>:open ...</code> with current location <code>http://www.example.com/dir1/dir2/file.html</code> will open <code>http://www.example.com</code><br/>"+
|
||||
" <code class=command>:open ./foo.html</code> with current location <code>http://www.example.com/dir1/dir2/file.html</code> will open <code>http://www.example.com/dir1/dir2/foo.html</code></li>"+
|
||||
" <li>Transformed to a relative URL of the current location if it starts with . or .. or ...;<br/>... is special and moves up the directory hierarchy as far as possible.<br/>"+
|
||||
"<ul><li><code class=command>:open ...</code> with current location <code>\"http://www.example.com/dir1/dir2/file.html\"</code> will open <code>\"http://www.example.com\"</code></li></li>"+
|
||||
"<li><code class=command>:open ./foo.html</code> with current location <code>\"http://www.example.com/dir1/dir2/file.html\"</code> will open <code>\"http://www.example.com/dir1/dir2/foo.html\"</code></li></ul></li>"+
|
||||
" <li>Opened with the default search engine if the first word is no search engine (<code>:open linus torvalds</code> will open a google search for linux torvalds).</li>"+
|
||||
" <li>Passed directly to Firefox in all other cases (<code class=command>:open www.osnews.com | www.slashdot.org</code> will open OSNews in the current, and Slashdot in a new background tab).</li></ol>"+
|
||||
"You WILL be able to use <code class=command>:open [-T \"linux\"] torvalds<Tab></code> to complete bookmarks with tag \"linux\" and which contain \"torvalds\". Note that -T support is only available for tab completion, not for the actual command.<br/>"+
|
||||
@@ -1313,8 +1314,13 @@ function stringToURLs(str)
|
||||
|
||||
// first check if the first word is a search engine
|
||||
var matches = urls[url].match(/^\s*(\w+)\s*(.*)/);
|
||||
var alias = matches[1] || null;
|
||||
var text = matches[2] || null;
|
||||
var alias = null;
|
||||
var text = null;
|
||||
if (matches && matches[1])
|
||||
alias = matches[1];
|
||||
if (matches && matches[2])
|
||||
text = matches[2];
|
||||
|
||||
if (alias)
|
||||
{
|
||||
var engine = search_service.getEngineByAlias(alias);
|
||||
@@ -1335,9 +1341,11 @@ function stringToURLs(str)
|
||||
{
|
||||
var default_engine = search_service.defaultEngine;
|
||||
if (default_engine)
|
||||
{
|
||||
urls[url] = default_engine.getSubmission(urls[url], null).uri.spec;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// check for ./ and ../ (or even .../) to go to a file in the upper directory
|
||||
@@ -1453,6 +1461,17 @@ function getCurrentLocation()
|
||||
return content.document.location.href;
|
||||
}
|
||||
|
||||
/* returns the current title or null */
|
||||
function getCurrentTitle()
|
||||
{
|
||||
var titles = window.content.document.getElementsByTagName('title');
|
||||
if (titles.length >= 1)
|
||||
return titles[0];
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
function goUp(count)
|
||||
{
|
||||
var gocmd = "";
|
||||
@@ -1502,12 +1521,18 @@ function bmadd(str)
|
||||
if (parseBookmarkString(str, res))
|
||||
{
|
||||
if(res.url == null)
|
||||
{
|
||||
res.url = getCurrentLocation();
|
||||
if(res.title == null) // XXX: maybe use current title of webpage
|
||||
// also guess title if the current url is :bmadded
|
||||
if(res.title == null)
|
||||
res.title = getCurrentTitle();
|
||||
}
|
||||
|
||||
if(res.title == null) // title could still be null
|
||||
res.title = res.url;
|
||||
|
||||
addBookmark(res.title, res.url);
|
||||
echo("Bookmark `" + res.url + "' added");
|
||||
echo("Bookmark `" + res.title + "' added with url `" + res.url + "'");
|
||||
}
|
||||
else
|
||||
echo("Usage: :bmadd [-t \"My Title\"] [-T tag1,tag2] <url>");
|
||||
|
||||
@@ -228,14 +228,21 @@ function build_longest_common_substring(list, filter)/*{{{*/
|
||||
var filtered = [];
|
||||
//var filter_length = filter.length;
|
||||
//filter = filter.toLowerCase();
|
||||
var ignorecase = false;
|
||||
if(filter == filter.toLowerCase())
|
||||
ignorecase = true;
|
||||
|
||||
for (var i = 0; i < list.length; i++)
|
||||
{
|
||||
for (var j = 0; j < list[i][0].length; j++)
|
||||
{
|
||||
var item = list[i][0][j].toLowerCase();
|
||||
var item = list[i][0][j];
|
||||
if(ignorecase)
|
||||
item = item.toLowerCase();
|
||||
|
||||
if (item.indexOf(filter) == -1)
|
||||
continue;
|
||||
|
||||
if (g_substrings.length == 0)
|
||||
{
|
||||
//alert('if: ' + item);
|
||||
@@ -333,8 +340,10 @@ function filter_url_array(urls, filter)/*{{{*/
|
||||
return [$_[0], $_[1]]
|
||||
});
|
||||
|
||||
var filter_length = filter.length;
|
||||
filter = filter.toLowerCase();
|
||||
//var filter_length = filter.length;
|
||||
var ignorecase = false;
|
||||
if(filter == filter.toLowerCase())
|
||||
ignorecase = true;
|
||||
|
||||
/*
|
||||
* Longest Common Subsequence
|
||||
@@ -343,8 +352,13 @@ function filter_url_array(urls, filter)/*{{{*/
|
||||
*/
|
||||
for (var i = 0; i < urls.length; i++)
|
||||
{
|
||||
var url = urls[i][0].toLowerCase();
|
||||
var title = urls[i][1].toLowerCase();
|
||||
var url = urls[i][0];
|
||||
var title = urls[i][1];
|
||||
if(ignorecase)
|
||||
{
|
||||
url = url.toLowerCase();
|
||||
title = title.toLowerCase();
|
||||
}
|
||||
|
||||
if (url.indexOf(filter) == -1)
|
||||
{
|
||||
@@ -358,7 +372,7 @@ function filter_url_array(urls, filter)/*{{{*/
|
||||
var url_length = url.length;
|
||||
for (var k = url.indexOf(filter); k != -1 && k <= last_index; k = url.indexOf(filter, k + 1))
|
||||
{
|
||||
for (var l = k + filter_length; l <= url_length; l++)
|
||||
for (var l = k + filter.length; l <= url_length; l++)
|
||||
g_substrings.push(url.substring(k, l));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user