From 331cf1fc52f68feba69d65be4a3039e7830bf884 Mon Sep 17 00:00:00 2001 From: Martin Stubenschrott Date: Fri, 27 Jul 2007 00:01:15 +0000 Subject: [PATCH] stringToURLs -> String.prototype.toURLArray --- ChangeLog | 3 ++- chrome/content/vimperator/commands.js | 9 +++++---- chrome/content/vimperator/hints.js | 11 +++++++++++ 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1dc31040..15fc219b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,8 +1,9 @@
 2007-07-02:
-	* version ???
+	* version 0.5
 	* new :map, :noremap, :mapclear and :unmap commands
 	* :saveas finally works (by calmar)
+	* Shift-insert pastes the selection content in text fields now
 	* Changed "|" to ", " as a url seperator in :open
 	* Ctrl-^ mapping for selecting the alternate tab/buffer
 	* QuickMarks support (new commands :qmarks/:qmarkadd/:qmarkdel and
diff --git a/chrome/content/vimperator/commands.js b/chrome/content/vimperator/commands.js
index 63534461..09a3a7ee 100644
--- a/chrome/content/vimperator/commands.js
+++ b/chrome/content/vimperator/commands.js
@@ -1178,7 +1178,7 @@ function execute(string)
 
 function openURLs(str)
 {
-    var urls = stringToURLs(str);
+    var urls = str.toURLArray();
     if (urls.length == 0)
         return false;
 
@@ -1192,7 +1192,7 @@ function openURLs(str)
 
 function openURLsInNewTab(str, activate)
 {
-    var urls = stringToURLs(str);
+    var urls = str.toURLArray();
     if (urls.length == 0)
         return null;
 
@@ -1208,9 +1208,10 @@ function openURLsInNewTab(str, activate)
 /* takes a string like 'google bla| www.osnews.com'
  * and returns an array ['www.google.com/search?q=bla', 'www.osnews.com']
  */
-function stringToURLs(str)
+//function stringToURLs(str)
+String.prototype.toURLArray = function()
 {
-    var urls = str.split(/\s*\,\s+/);
+    var urls = this.split(/\s*\,\s+/);
     begin: for (var url = 0; url < urls.length; url++)
     {
         // check for ./ and ../ (or even .../) to go to a file in the upper directory
diff --git a/chrome/content/vimperator/hints.js b/chrome/content/vimperator/hints.js
index 34e718c0..a0265f0e 100644
--- a/chrome/content/vimperator/hints.js
+++ b/chrome/content/vimperator/hints.js
@@ -100,6 +100,17 @@ function Hints() //{{{
 
     function genElemCoords(elem)
     {
+        // NOTE: experiment for making the function faster, report problems
+        try {
+            var box = window.content.document.getBoxObjectFor(elem);
+            elem.absoLeft = box.x;
+            elem.absoTop = box.y;
+            elem.validCoord = elem.ownerDocument.validCoords;
+        } catch(e) { 
+            elem.absoLeft = 0;
+            elem.absoTop = 0;
+        }
+        return;
         if (typeof(elem.validCoord) != "undefined")
         {
             if (elem.validCoord == elem.ownerDocument.validCoords)