Diff for /loncom/interface/loncommon.pm between versions 1.1419 and 1.1420

version 1.1419, 2023/11/18 21:12:45 version 1.1420, 2023/11/18 21:50:06
Line 2441  END Line 2441  END
   
 =pod  =pod
   
   =item * &iframe_wrapper_headjs()
   
   #
   # Where iframe is in use, if window.onload() executes before the custom resize function
   # has been defined (jQuery), two global javascript vars (LCnotready and LCresizedef)
   # are used to ensure document.ready() triggers a call to resize, so the iframe contents
   # do not obscure the Functions menu.
   #
   
   =back
   
   =cut
   
   
   sub iframe_wrapper_headjs {
       return <<"ENDJS";
   <script type="text/javascript">
   // <![CDATA[
   var LCnotready = 0;
   var LCresizedef = 0;
   // ]]>
   </script>
   
   ENDJS
   
   }
   
   =pod
   
   =item * &iframe_wrapper_resizejs()
   
   #
   # jQuery to use when iframe is in use and a page resize occurs.
   # This script will ensure that the iframe does not obscure any
   # standard LON-CAPA inline menus (primary, secondary, and/or
   # breadcrumbs and Functions menus. Expects javascript from
   # &iframe_wrapper_headjs() to be in head portion of the web page,
   # e.g., by inclusion in second arg passed to &start_page().
   #
   
   =back
   
   =cut
   
   sub iframe_wrapper_resizejs {
       my $offset = 5;
       &get_unprocessed_cgi($ENV{'QUERY_STRING'},['inhibitmenu']);
       if (($env{'form.inhibitmenu'} eq 'yes') || ($env{'form.only_body'})) {
           $offset = 0;
       }
       return &Apache::lonhtmlcommon::scripttag(<<SCRIPT);
       \$(document).ready( function() {
           \$(window).unbind('resize').resize(function(){
               var header = null;
               var offset = $offset;
               var height = 0;
               var hdrtop = 0;
               if (\$('div.LC_head_subbox:first').length) {
                   header = \$('div.LC_head_subbox:first');
                   offset = 9;
               } else {
                   if (\$('#LC_breadcrumbs').length) {
                       header = \$('#LC_breadcrumbs');
                   }
               }
               if (header != null && header.length) {
                   height = header.height();
                   hdrtop = header.position().top;
               }
               var pos = height + hdrtop + offset;
               \$('.LC_iframecontainer').css('top', pos);
           });
           LCresizedef = 1;
           if (LCnotready == 1) {
               LCnotready = 0;
               \$(window).trigger('resize');
           }
       });
       window.onload = function(){
            if (LCresizedef) {
                LCnotready = 0;
                \$(window).trigger('resize');
            } else {
                LCnotready = 1;
            }
       };
   SCRIPT
   
   }
   
   =pod
   
 =head1 Excel and CSV file utility routines  =head1 Excel and CSV file utility routines
   
 =cut  =cut

Removed from v.1.1419  
changed lines
  Added in v.1.1420


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>