/** * Generate any HTML that needs to go at the start of the <body> tag. * * Normally, this method is called automatically by the code that prints the * <head> tag. You should not normally need to call it in your own code. * * @param renderer_base $renderer * @return string the HTML code to go at the start of the <body> tag. */ public function get_top_of_body_code(renderer_base $renderer) { // First the skip links. $output = $renderer->render_skip_links($this->skiplinks); // YUI3 JS needs to be loaded early in the body. It should be cached well by the browser. $output .= $this->get_yui3lib_headcode(); // Add hacked jQuery support, it is not intended for standard Moodle distribution! $output .= $this->get_jquery_headcode(); // Link our main JS file, all core stuff should be there. $output .= html_writer::script('', $this->js_fix_url('/lib/javascript-static.js')); // All the other linked things from HEAD - there should be as few as possible. if ($this->jsincludes['head']) { foreach ($this->jsincludes['head'] as $url) { $output .= html_writer::script('', $url); } } // Then the clever trick for hiding of things not needed when JS works. $output .= html_writer::script("document.body.className += ' jsenabled';") . "\n"; $this->topofbodydone = true; return $output; }