Include NWMatcher as a submodule.

This commit is contained in:
Tobie Langel 2009-10-23 07:18:52 +02:00
parent 17e8064d8a
commit 15c323b9ac
5 changed files with 13 additions and 1449 deletions

3
.gitmodules vendored
View File

@ -14,3 +14,6 @@
[submodule "vendor/sizzle/sizzle"]
path = vendor/sizzle/sizzle
url = git://github.com/jeresig/sizzle.git
[submodule "vendor/nwmatcher/nwmatcher"]
path = vendor/nwmatcher/nwmatcher
url = git://github.com/dperini/nwmatcher.git

View File

@ -40,6 +40,7 @@ module PrototypeHelper
def self.sprocketize(path, source, destination = nil, strip_comments = true)
require_sprockets
require_sizzle
require_nwmatcher
secretary = Sprockets::Secretary.new(
:root => File.join(ROOT_DIR, path),
:load_path => self.load_path,
@ -100,6 +101,12 @@ module PrototypeHelper
end
end
def self.require_nwmatcher
if !File.exists?(File.join(ROOT_DIR, 'vendor', 'nwmatcher', 'src', 'nwmatcher.js'))
exit unless get_submodule("NWMmatcher", "nwmatcher/nwmatcher")
end
end
def self.get_submodule(name, path)
require_git
puts "\nYou seem to be missing #{name}. Obtaining it via git...\n\n"

1
vendor/nwmatcher/nwmatcher vendored Submodule

@ -0,0 +1 @@
Subproject commit c9f5d5d4fc4ca294477f803bb8d688a8d45de664

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
Prototype._original_nw = window.NW;
//= require <nwmatcher-1.1.1>
//= require "nwmatcher/src/nwmatcher"
Prototype.NW = window.NW;
// Restore globals.
@ -7,14 +7,8 @@ window.NW = Prototype._original_nw;
delete Prototype._original_nw;
Prototype.Selector = (function(NW) {
function extend(elements) {
for (var i = 0, length = elements.length; i < length; i++)
elements[i] = Element.extend(elements[i]);
return elements;
}
function select(selector, scope) {
return extend(NW.select(selector, scope || document));
return NW.select(selector, scope || document, null, Element.extend);
}
function filter(elements, selector) {