scriptaculous.js 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. // script.aculo.us scriptaculous.js v1.9.0, Thu Dec 23 16:54:48 -0500 2010
  2. // Copyright (c) 2005-2010 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining
  5. // a copy of this software and associated documentation files (the
  6. // "Software"), to deal in the Software without restriction, including
  7. // without limitation the rights to use, copy, modify, merge, publish,
  8. // distribute, sublicense, and/or sell copies of the Software, and to
  9. // permit persons to whom the Software is furnished to do so, subject to
  10. // the following conditions:
  11. //
  12. // The above copyright notice and this permission notice shall be
  13. // included in all copies or substantial portions of the Software.
  14. //
  15. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  16. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  17. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  18. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  19. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  20. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  21. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22. //
  23. // For details, see the script.aculo.us web site: http://script.aculo.us/
  24. var Scriptaculous = {
  25. Version: '1.9.0',
  26. require: function(libraryName) {
  27. try{
  28. // inserting via DOM fails in Safari 2.0, so brute force approach
  29. document.write('<script type="text/javascript" src="'+libraryName+'"><\/script>');
  30. } catch(e) {
  31. // for xhtml+xml served content, fall back to DOM methods
  32. var script = document.createElement('script');
  33. script.type = 'text/javascript';
  34. script.src = libraryName;
  35. document.getElementsByTagName('head')[0].appendChild(script);
  36. }
  37. },
  38. REQUIRED_PROTOTYPE: '1.6.0.3',
  39. load: function() {
  40. function convertVersionString(versionString) {
  41. var v = versionString.replace(/_.*|\./g, '');
  42. v = parseInt(v + '0'.times(4-v.length));
  43. return versionString.indexOf('_') > -1 ? v-1 : v;
  44. }
  45. if((typeof Prototype=='undefined') ||
  46. (typeof Element == 'undefined') ||
  47. (typeof Element.Methods=='undefined') ||
  48. (convertVersionString(Prototype.Version) <
  49. convertVersionString(Scriptaculous.REQUIRED_PROTOTYPE)))
  50. throw("script.aculo.us requires the Prototype JavaScript framework >= " +
  51. Scriptaculous.REQUIRED_PROTOTYPE);
  52. var js = /scriptaculous\.js(\?.*)?$/;
  53. $$('script[src]').findAll(function(s) {
  54. return s.src.match(js);
  55. }).each(function(s) {
  56. var path = s.src.replace(js, ''),
  57. includes = s.src.match(/\?.*load=([a-z,]*)/);
  58. (includes ? includes[1] : 'builder,effects,dragdrop,controls,slider,sound').split(',').each(
  59. function(include) { Scriptaculous.require(path+include+'.js') });
  60. });
  61. }
  62. };
  63. Scriptaculous.load();