Ticket #3519: 3519.diff

File 3519.diff, 5.2 kB (added by mdawaffe, 2 years ago)
  • wp-includes/js/scriptaculous/wp-scriptaculous.js

    old new  
     1// Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) 
     2//  
     3// Permission is hereby granted, free of charge, to any person obtaining 
     4// a copy of this software and associated documentation files (the 
     5// "Software"), to deal in the Software without restriction, including 
     6// without limitation the rights to use, copy, modify, merge, publish, 
     7// distribute, sublicense, and/or sell copies of the Software, and to 
     8// permit persons to whom the Software is furnished to do so, subject to 
     9// the following conditions: 
     10//  
     11// The above copyright notice and this permission notice shall be 
     12// included in all copies or substantial portions of the Software. 
     13 
     14var Scriptaculous = { 
     15  Version: '1.6.1', 
     16  require: function(libraryName) { 
     17    // inserting via DOM fails in Safari 2.0, so brute force approach 
     18    document.write('<script type="text/javascript" src="'+libraryName+'"></script>'); 
     19  }, 
     20  load: function() { 
     21    if((typeof Prototype=='undefined') ||  
     22       (typeof Element == 'undefined') ||  
     23       (typeof Element.Methods=='undefined') || 
     24       parseFloat(Prototype.Version.split(".")[0] + "." + 
     25                  Prototype.Version.split(".")[1]) < 1.5) 
     26       throw("script.aculo.us requires the Prototype JavaScript framework >= 1.5.0"); 
     27     
     28    $A(document.getElementsByTagName("script")).findAll( function(s) { 
     29      return (s.src && s.src.match(/scriptaculous\.js(\?.*)?$/)) 
     30    }).each( function(s) { 
     31      var path = s.src.replace(/scriptaculous\.js(\?.*)?$/,''); 
     32      var includes = s.src.match(/\?.*load=([a-z,]*)/); 
     33      if ( includes ) 
     34       includes[1].split(',').each( 
     35       function(include) { Scriptaculous.require(path+include+'.js') }); 
     36    }); 
     37  } 
     38} 
     39 
     40Scriptaculous.load(); 
  • wp-includes/script-loader.php

    old new  
    2222                $this->add( 'autosave', '/wp-includes/js/autosave.js.php', array('prototype', 'sack'), '4508'); 
    2323                $this->add( 'wp-ajax', '/wp-includes/js/wp-ajax-js.php', array('prototype'), '4459'); 
    2424                $this->add( 'listman', '/wp-includes/js/list-manipulation-js.php', array('wp-ajax', 'fat'), '4583'); 
    25                 $this->add( 'scriptaculous', '/wp-includes/js/scriptaculous/scriptaculous.js', array('prototype'), '1.6.1'); 
    26                 $this->add( 'scriptaculous-dragdrop', '/wp-includes/js/scriptaculous/scriptaculous.js?load=builder,dragdrop', array('prototype'), '1.6.1'); 
    27                 $this->add( 'scriptaculous-slider', '/wp-includes/js/scriptaculous/scriptaculous.js?load=slider,effects', array('prototype'), '1.6.1'); 
    28                 $this->add( 'scriptaculous-controls', '/wp-includes/js/scriptaculous/scriptaculous.js?load=controls', array('prototype'), '1.6.1'); 
     25                $this->add( 'scriptaculous-root', '/wp-includes/js/scriptaculous/wp-scriptaculous.js', array('prototype'), '1.6.1'); 
     26                $this->add( 'scriptaculous-builder', '/wp-includes/js/scriptaculous/builder.js', array('scriptaculous-root'), '1.6.1'); 
     27                $this->add( 'scriptaculous-dragdrop', '/wp-includes/js/scriptaculous/dragdrop.js', array('scriptaculous-builder'), '1.6.1'); 
     28                $this->add( 'scriptaculous-effects', '/wp-includes/js/scriptaculous/effects.js', array('scriptaculous-root'), '1.6.1'); 
     29                $this->add( 'scriptaculous-slider', '/wp-includes/js/scriptaculous/slider.js', array('scriptaculous-effects'), '1.6.1'); 
     30                $this->add( 'scriptaculous-controls', '/wp-includes/js/scriptaculous/controls.js', array('scriptaculous-root'), '1.6.1'); 
     31                $this->add( 'scriptaculous', '', array('scriptaculous-dragdrop', 'scriptaculous-slider', 'scriptaculous-controls'), '1.6.1'); 
    2932                $this->add( 'cropper', '/wp-includes/js/crop/cropper.js', array('scriptaculous-dragdrop'), '1'); 
    3033                if ( is_admin() ) { 
    3134                        $this->add( 'dbx-admin-key', '/wp-admin/dbx-admin-key-js.php', array('dbx'), '3651' ); 
     
    7073                        elseif ( is_array($handles[$handle]) ) 
    7174                                $this->_print_scripts( $handles[$handle] ); 
    7275                        if ( !in_array($handle, $this->printed) && isset($this->scripts[$handle]) ) { 
    73                                 $ver = $this->scripts[$handle]->ver ? $this->scripts[$handle]->ver : $wp_db_version; 
    74                                 if ( isset($this->args[$handle]) ) 
    75                                         $ver .= '&amp;' . $this->args[$handle]; 
    76                                 $src = 0 === strpos($this->scripts[$handle]->src, 'http://') ? $this->scripts[$handle]->src : get_option( 'siteurl' ) . $this->scripts[$handle]->src; 
    77                                 echo "<script type='text/javascript' src='$src?ver=$ver'></script>\n"; 
     76                                if ( $this->scripts[$handle]->src ) { // Else it defines a group. 
     77                                        $ver = $this->scripts[$handle]->ver ? $this->scripts[$handle]->ver : $wp_db_version; 
     78                                        if ( isset($this->args[$handle]) ) 
     79                                                $ver .= '&amp;' . $this->args[$handle]; 
     80                                        $src = 0 === strpos($this->scripts[$handle]->src, 'http://') ? $this->scripts[$handle]->src : get_option( 'siteurl' ) . $this->scripts[$handle]->src; 
     81                                        $src = add_query_arg('ver', $ver, $src); 
     82                                        echo "<script type='text/javascript' src='$src'></script>\n"; 
     83                                } 
    7884                                $this->printed[] = $handle; 
    7985                        } 
    8086                }