mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-21 21:38:11 +01:00
stringToURLs -> String.prototype.toURLArray
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
<pre>
|
||||
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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user