Change way of getting domain, use more efficient parseuri.js
This commit is contained in:
parent
aad001bb25
commit
93ccb6802b
|
@ -1,4 +1,4 @@
|
||||||
gPass : global password
|
gPass : global Password
|
||||||
=======================
|
=======================
|
||||||
|
|
||||||
Introduction
|
Introduction
|
||||||
|
|
|
@ -25,6 +25,7 @@ var Hashtable = require("jshashtable-3.0").Hashtable;
|
||||||
// http://code.google.com/p/crypto-js/
|
// http://code.google.com/p/crypto-js/
|
||||||
var sha256 = require("jssha256").sha256;
|
var sha256 = require("jssha256").sha256;
|
||||||
var aes = require("jsaes").aes;
|
var aes = require("jsaes").aes;
|
||||||
|
var parseURI = require("parseuri").parseURI;
|
||||||
var prefSet = require("simple-prefs");
|
var prefSet = require("simple-prefs");
|
||||||
// Global document
|
// Global document
|
||||||
var doc;
|
var doc;
|
||||||
|
@ -62,7 +63,8 @@ function on_sumbit()
|
||||||
var fields = form.getElementsByTagName("input");
|
var fields = form.getElementsByTagName("input");
|
||||||
var my_map = new Hashtable();
|
var my_map = new Hashtable();
|
||||||
|
|
||||||
domain = form.ownerDocument.domain;
|
domain = parseURI.parseUri(form.ownerDocument.baseURI);
|
||||||
|
domain = domain["host"];
|
||||||
|
|
||||||
// Get all <input type="text">
|
// Get all <input type="text">
|
||||||
for (i=0; i<fields.length; i++)
|
for (i=0; i<fields.length; i++)
|
||||||
|
|
32
firefox_addon/lib/parseuri.js
Normal file
32
firefox_addon/lib/parseuri.js
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
// parseUri 1.2.2
|
||||||
|
// (c) Steven Levithan <stevenlevithan.com>
|
||||||
|
// MIT License
|
||||||
|
|
||||||
|
exports.parseURI = {
|
||||||
|
|
||||||
|
parseUri : function (str) {
|
||||||
|
var o = {
|
||||||
|
strictMode: false,
|
||||||
|
key: ["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],
|
||||||
|
q: {
|
||||||
|
name: "queryKey",
|
||||||
|
parser: /(?:^|&)([^&=]*)=?([^&]*)/g
|
||||||
|
},
|
||||||
|
parser: {
|
||||||
|
strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,
|
||||||
|
loose: /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/
|
||||||
|
}},
|
||||||
|
m = o.parser[o.strictMode ? "strict" : "loose"].exec(str),
|
||||||
|
uri = {},
|
||||||
|
i = 14;
|
||||||
|
|
||||||
|
while (i--) uri[o.key[i]] = m[i] || "";
|
||||||
|
|
||||||
|
uri[o.q.name] = {};
|
||||||
|
uri[o.key[12]].replace(o.q.parser, function ($0, $1, $2) {
|
||||||
|
if ($1) uri[o.q.name][$1] = $2;
|
||||||
|
});
|
||||||
|
|
||||||
|
return uri;
|
||||||
|
}
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user