| | 26 | REQUIRED_PROTOTYPE: '1.5.2', |
|---|
| | 27 | |
|---|
| | 28 | // Start with the element "el" and recursively descend the DOM |
|---|
| | 29 | // looking for the scriptaculous.js script element. |
|---|
| | 30 | // |
|---|
| | 31 | // This method is used because getElementsByTagName() doesn't |
|---|
| | 32 | // work twice in Firefox in the head element during load. |
|---|
| | 33 | // So if a a developer tries to clone this script for their own |
|---|
| | 34 | // scripts then things will break in the second use of this type |
|---|
| | 35 | // of loader. |
|---|
| | 36 | // As described in #4335 by petermichaux. |
|---|
| | 37 | search: function(el) { |
|---|
| | 38 | if (el.src && el.src.match(/scriptaculous\.js(\?.*)?$/)) { |
|---|
| | 39 | return el; |
|---|
| | 40 | } |
|---|
| | 41 | |
|---|
| | 42 | var kids = el.childNodes, |
|---|
| | 43 | s; // holds the scriptaculous script element if found |
|---|
| | 44 | |
|---|
| | 45 | for (var i=0; i<kids.length; i++) { |
|---|
| | 46 | if (s = this.search(kids[i])) { // yes just one equals sign |
|---|
| | 47 | return s; |
|---|
| | 48 | } |
|---|
| | 49 | } |
|---|
| | 50 | }, |
|---|
| | 51 | |
|---|
| 45 | | $A(document.getElementsByTagName("script")).findAll( function(s) { |
|---|
| 46 | | return (s.src && s.src.match(/scriptaculous\.js(\?.*)?$/)) |
|---|
| 47 | | }).each( function(s) { |
|---|
| 48 | | var path = s.src.replace(/scriptaculous\.js(\?.*)?$/,''); |
|---|
| 49 | | var includes = s.src.match(/\?.*load=([a-z,]*)/); |
|---|
| 50 | | (includes ? includes[1] : 'builder,effects,dragdrop,controls,slider,sound').split(',').each( |
|---|
| 51 | | function(include) { Scriptaculous.require(path+include+'.js') }); |
|---|
| 52 | | }); |
|---|
| | 71 | var s = this.search(document), // holds the scriptaculous script element |
|---|
| | 72 | path = s.src.replace(/scriptaculous\.js(\?.*)?$/, ''), |
|---|
| | 73 | includes = s.src.match(/\?.*load=([a-z,]*)/); |
|---|
| | 74 | |
|---|
| | 75 | // include the files specified in the scriptaculous script element src attribute |
|---|
| | 76 | // or all the scriptaculous files |
|---|
| | 77 | includes = (includes ? includes[1] : 'builder,effects,dragdrop,controls,slider').split(','); |
|---|
| | 78 | |
|---|
| | 79 | for (var i=0; i<includes.length; i++) { |
|---|
| | 80 | this.require(path + includes[i] + '.js'); |
|---|
| | 81 | } |
|---|