Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-15729

JS Error in websitetoolbar link button if YUI doesn't load + empty page if clicked before page load

    XMLWordPrintable

Details

    Description

      Alternative template that only shows the button when loaded, and also shows it when it is loaded instead of waiting for the whole document:

      <input type="image" class="hide" src="{'websitetoolbar/ezwt-icon-url.gif'ezimage('no')}" alt="{'Toggle menu link type edit.'|i18n( 'design/standard/parts/website_toolbar' )}" title="{'Toggle menu link type edit.'|i18n( 'design/standard/parts/website_toolbar' )}" id="ezwt-link-switcher" />
      
      {ezscript_require( 'ezjsc::yui3' )}
      <script type="text/javascript">
      {literal}
          if ( window.YUI !== undefined ) YUI( YUI3_config ).use('node', function(Y) {
              Y.on('contentready', function() {
                  Y.get('#ezwt-link-switcher').removeClass('hide').on('click', function(e) {
                      Y.Node.all('.menu-item-link').each(function(n, v) {
                          var rel = n.get('rel'), href = n.get('href');
                          n.set('rel',  href);
                          n.set('href', rel);
                      });
                      e.preventDefault();
                  });
              }, '#ezwt-link-switcher' );
          });
      {/literal}
      </script>
      

      Attachments

        Activity

          People

            ls ls
            andre1 andre1
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: