Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Move convert2RegExp into a module.

Also:
* Add GM_ prefix.
* Separate into "third-party" and restore the original license notice.
  • Loading branch information...
commit ada8e86ad7b4a1b1c27ca9541f2dc48d65ed7c4b 1 parent bde6904
@arantius arantius authored
View
1  components/greasemonkey.js
@@ -209,7 +209,6 @@ function startup() {
loader.loadSubScript("chrome://greasemonkey/content/scriptrequire.js");
loader.loadSubScript("chrome://greasemonkey/content/scriptresource.js");
loader.loadSubScript("chrome://greasemonkey/content/scripticon.js");
- loader.loadSubScript("chrome://greasemonkey/content/convert2RegExp.js");
loader.loadSubScript("chrome://greasemonkey/content/miscapis.js");
loader.loadSubScript("chrome://greasemonkey/content/xmlhttprequester.js");
loader.loadSubScript("chrome://greasemonkey/content/scriptdownloader.js");
View
4 content/script.js
@@ -1,3 +1,5 @@
+Components.utils.import("resource://greasemonkey/third-party/convert2RegExp.js");
+
function Script(configNode) {
this._observers = [];
@@ -38,7 +40,7 @@ Script.prototype.matchesURL = function(url) {
return false;
}
- return convert2RegExp(glob).test(url);
+ return GM_convert2RegExp(glob).test(url);
}
return GM_isGreasemonkeyable(url)
View
37 content/convert2RegExp.js → modules/third-party/convert2RegExp.js
@@ -1,6 +1,37 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is AdBlock for Mozilla.
+ *
+ * The Initial Developer of the Original Code is
+ * Henrik Aasted Sorensen.
+ * Portions created by the Initial Developer are Copyright (C) 2002
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Henrik Aasted Sorensen <henrik@aasted.org>
+ * Stefan Kinitz <mcmurmel.blah@gmx.de>
+ * Rue <quill@ethereal.net>
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var EXPORTED_SYMBOLS = ['GM_convert2RegExp'];
+
+Components.utils.import("resource://greasemonkey/utils.js");
+
+
// Converts a pattern in this programs simple notation to a regular expression.
-// thanks AdBlock! http://www.mozdev.org/source/browse/adblock/adblock/
-function convert2RegExp( pattern ) {
+function GM_convert2RegExp( pattern ) {
var s = new String(pattern);
var res = new String("^");
@@ -47,4 +78,4 @@ function convert2RegExp( pattern ) {
}
return new RegExp(res + "$", "i");
}
-convert2RegExp = GM_memoize(convert2RegExp);
+GM_convert2RegExp = GM_memoize(GM_convert2RegExp);
Please sign in to comment.
Something went wrong with that request. Please try again.