diff --git a/Makefile b/Makefile index 6b69f274..5b98974e 100644 --- a/Makefile +++ b/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" ; \ diff --git a/chrome/content/vimperator/commands.js b/chrome/content/vimperator/commands.js index 1f9748bf..26635c40 100644 --- a/chrome/content/vimperator/commands.js +++ b/chrome/content/vimperator/commands.js @@ -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.
" + "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.
" + "You can omit the optional [url] field, so just do :bmadd to bookmark the currently loaded web page with a default title and without any tags.
" + - "The following options WILL be interpretted in the future:
" + - " -t 'custom title'
" + - " -T comma,separated,tag,list
", + " -t \"custom title\"
" + + "The following options will be interpreted in the future:
" + + " -T comma,separated,tag,list
"+ + " -k keyword
", bmadd, null ], @@ -239,9 +240,9 @@ var g_commands = [/*{{{*/ "Multiple URLs can be separated with the | character.
" + "Each |-separated token is analayzed and in this order:
"+ "
  1. 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 (:open wiki linus torvalds will open the wikipedia entry for linux torvalds).
  2. "+ - "
  3. Transformed to a relative URL of the current location if it starts with . or .. or ...;
    ... is special and goes to the moves up the directory hierarchy as far as possible.
    "+ - " :open ... with current location http://www.example.com/dir1/dir2/file.html will open http://www.example.com
    "+ - " :open ./foo.html with current location http://www.example.com/dir1/dir2/file.html will open http://www.example.com/dir1/dir2/foo.html
  4. "+ + "
  5. Transformed to a relative URL of the current location if it starts with . or .. or ...;
    ... is special and moves up the directory hierarchy as far as possible.
    "+ + "
  6. "+ "
  7. Opened with the default search engine if the first word is no search engine (:open linus torvalds will open a google search for linux torvalds).
  8. "+ "
  9. Passed directly to Firefox in all other cases (:open www.osnews.com | www.slashdot.org will open OSNews in the current, and Slashdot in a new background tab).
"+ "You WILL be able to use :open [-T \"linux\"] torvalds<Tab> 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.
"+ @@ -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,8 +1341,10 @@ function stringToURLs(str) { var default_engine = search_service.defaultEngine; if (default_engine) + { urls[url] = default_engine.getSubmission(urls[url], null).uri.spec; - continue; + continue; + } } @@ -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] "); diff --git a/chrome/content/vimperator/completion.js b/chrome/content/vimperator/completion.js index cc74c1dd..8f9fc6ee 100644 --- a/chrome/content/vimperator/completion.js +++ b/chrome/content/vimperator/completion.js @@ -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)); } }