web/wp-includes/js/scriptaculous/wp-scriptaculous.js
changeset 194 32102edaa81b
parent 136 bde1974c263b
equal deleted inserted replaced
193:2f6f6f7551ca 194:32102edaa81b
     1 // script.aculo.us scriptaculous.js v1.7.1_beta3, Fri May 25 17:19:41 +0200 2007
     1 // script.aculo.us scriptaculous.js v1.8.3, Thu Oct 08 11:23:33 +0200 2009
     2 
     2 
     3 // Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
     3 // Copyright (c) 2005-2009 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
     4 // 
     4 //
     5 // Permission is hereby granted, free of charge, to any person obtaining
     5 // Permission is hereby granted, free of charge, to any person obtaining
     6 // a copy of this software and associated documentation files (the
     6 // a copy of this software and associated documentation files (the
     7 // "Software"), to deal in the Software without restriction, including
     7 // "Software"), to deal in the Software without restriction, including
     8 // without limitation the rights to use, copy, modify, merge, publish,
     8 // without limitation the rights to use, copy, modify, merge, publish,
     9 // distribute, sublicense, and/or sell copies of the Software, and to
     9 // distribute, sublicense, and/or sell copies of the Software, and to
    10 // permit persons to whom the Software is furnished to do so, subject to
    10 // permit persons to whom the Software is furnished to do so, subject to
    11 // the following conditions:
    11 // the following conditions:
    12 // 
    12 //
    13 // The above copyright notice and this permission notice shall be
    13 // The above copyright notice and this permission notice shall be
    14 // included in all copies or substantial portions of the Software.
    14 // included in all copies or substantial portions of the Software.
    15 //
    15 //
    16 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
    16 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
    17 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
    17 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
    22 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    22 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    23 //
    23 //
    24 // For details, see the script.aculo.us web site: http://script.aculo.us/
    24 // For details, see the script.aculo.us web site: http://script.aculo.us/
    25 
    25 
    26 var Scriptaculous = {
    26 var Scriptaculous = {
    27   Version: '1.8.0',
    27   Version: '1.8.3',
    28   require: function(libraryName) {
    28   require: function(libraryName) {
    29     // inserting via DOM fails in Safari 2.0, so brute force approach
    29     try{
    30     document.write('<script type="text/javascript" src="'+libraryName+'"></script>');
    30       // inserting via DOM fails in Safari 2.0, so brute force approach
       
    31       document.write('<script type="text/javascript" src="'+libraryName+'"><\/script>');
       
    32     } catch(e) {
       
    33       // for xhtml+xml served content, fall back to DOM methods
       
    34       var script = document.createElement('script');
       
    35       script.type = 'text/javascript';
       
    36       script.src = libraryName;
       
    37       document.getElementsByTagName('head')[0].appendChild(script);
       
    38     }
    31   },
    39   },
    32   REQUIRED_PROTOTYPE: '1.6',
    40   REQUIRED_PROTOTYPE: '1.6.0.3',
    33   load: function() {
    41   load: function() {
    34     function convertVersionString(versionString){
    42     function convertVersionString(versionString) {
    35       var r = versionString.split('.');
    43       var v = versionString.replace(/_.*|\./g, '');
    36       return parseInt(r[0])*100000 + parseInt(r[1])*1000 + parseInt(r[2]);
    44       v = parseInt(v + '0'.times(4-v.length));
       
    45       return versionString.indexOf('_') > -1 ? v-1 : v;
    37     }
    46     }
    38  
    47 
    39     if((typeof Prototype=='undefined') || 
    48     if((typeof Prototype=='undefined') ||
    40        (typeof Element == 'undefined') || 
    49        (typeof Element == 'undefined') ||
    41        (typeof Element.Methods=='undefined') ||
    50        (typeof Element.Methods=='undefined') ||
    42        (convertVersionString(Prototype.Version) < 
    51        (convertVersionString(Prototype.Version) <
    43         convertVersionString(Scriptaculous.REQUIRED_PROTOTYPE)))
    52         convertVersionString(Scriptaculous.REQUIRED_PROTOTYPE)))
    44        throw("script.aculo.us requires the Prototype JavaScript framework >= " +
    53        throw("script.aculo.us requires the Prototype JavaScript framework >= " +
    45         Scriptaculous.REQUIRED_PROTOTYPE);
    54         Scriptaculous.REQUIRED_PROTOTYPE);
    46     
    55 
    47     $A(document.getElementsByTagName("script")).findAll( function(s) {
    56     var js = /scriptaculous\.js(\?.*)?$/;
    48       return (s.src && s.src.match(/scriptaculous\.js(\?.*)?$/))
    57     $$('head script[src]').findAll(function(s) {
    49     }).each( function(s) {
    58       return s.src.match(js);
    50       var path = s.src.replace(/scriptaculous\.js(\?.*)?$/,'');
    59     }).each(function(s) {
    51       var includes = s.src.match(/\?.*load=([a-z,]*)/);
    60 		var path = s.src.replace(js, ''),
    52       if ( includes )
    61 		includes = s.src.match(/\?.*load=([a-z,]*)/);
    53        includes[1].split(',').each(
    62 
    54        function(include) { Scriptaculous.require(path+include+'.js') });
    63 		// Modified for WordPress to work with enqueue_script
       
    64 		if ( includes ) {
       
    65 			includes[1].split(',').each( function(include) {
       
    66 				Scriptaculous.require(path+include+'.js')
       
    67 			});
       
    68 		}
    55     });
    69     });
    56   }
    70   }
    57 }
    71 };
    58 
    72 
    59 Scriptaculous.load();
    73 Scriptaculous.load();