Ticket #10966: improved_versioncheck_noloaderclashing.diff
| File improved_versioncheck_noloaderclashing.diff, 2.5 kB (added by staaky, 7 months ago) |
|---|
-
C:/svn/scriptaculous/src/scriptaculous.js
old new 1 // Copyright (c) 2005-200 7Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)1 // Copyright (c) 2005-2008 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) 2 2 // 3 3 // Permission is hereby granted, free of charge, to any person obtaining 4 4 // a copy of this software and associated documentation files (the … … 27 27 // inserting via DOM fails in Safari 2.0, so brute force approach 28 28 document.write('<script type="text/javascript" src="'+libraryName+'"><\/script>'); 29 29 }, 30 REQUIRED_PROTOTYPE: '1.6.0 ',30 REQUIRED_PROTOTYPE: '1.6.0.2', 31 31 load: function() { 32 function convertVersionString(versionString){ 33 var r = versionString.split('.'); 34 return parseInt(r[0])*100000 + parseInt(r[1])*1000 + parseInt(r[2]); 32 function convertVersionString(versionString) { 33 var v = versionString.replace(/_.*|\./g, ''); 34 v = parseInt(v + '0'.times(4-v.length)); 35 return versionString.indexOf('_') > -1 ? v-1 : v; 35 36 } 36 37 if((typeof Prototype=='undefined') || 38 (typeof Element == 'undefined') || 37 38 if((typeof Prototype=='undefined') || 39 (typeof Element == 'undefined') || 39 40 (typeof Element.Methods=='undefined') || 40 (convertVersionString(Prototype.Version) < 41 (convertVersionString(Prototype.Version) < 41 42 convertVersionString(Scriptaculous.REQUIRED_PROTOTYPE))) 42 43 throw("script.aculo.us requires the Prototype JavaScript framework >= " + 43 44 Scriptaculous.REQUIRED_PROTOTYPE); 44 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(\?.*)?$/,''); 45 46 var js = /scriptaculous\.js(\?.*)?$/; 47 $$('head script[src]').findAll(function(s) { 48 return s.src.match(js); 49 }).each(function(s) { 50 var path = s.src.replace(js,''); 49 51 var includes = s.src.match(/\?.*load=([a-z,]*)/); 50 52 (includes ? includes[1] : 'builder,effects,dragdrop,controls,slider,sound').split(',').each( 51 53 function(include) { Scriptaculous.require(path+include+'.js') });