Moodle
  1. Moodle
  2. MDL-16583

Clean up JavaScript usage in HEAD

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Deferred
    • Affects Version/s: 2.0
    • Fix Version/s: DEV backlog
    • Component/s: Libraries
    • Labels:
      None
    • Affected Branches:
      MOODLE_20_STABLE

      Description

      See the sub tasks for details.

        Gliffy Diagrams

          Issue Links

          1.
          Change admintree JavaScript to move the code out of the page, and into a separate .js file. Sub-task Closed Tim Hunt
           
          2.
          Move openpopup out of javascript.php and in to javascript-static.js Sub-task Closed Tim Hunt
           
          3.
          Output a standard set of config variables into JavaScript on every page Sub-task Closed Tim Hunt
           
          4.
          Move inserttext out of javascript.php and in to javascript-static.js Sub-task Closed Tim Hunt
           
          5.
          Emoticons help file contains JavaScript to insert the emoticons, but it won't acutally work in a lot of situations Sub-task Closed Tim Hunt
           
          6.
          Change require_js so that callers don't have to fiddly around with $CFG->wwwroot Sub-task Closed Tim Hunt
           
          7.
          Change require_js so JavaScript is included in the page footer by default, but with an option to output it sooner Sub-task Closed Tim Hunt
           
          8.
          Make a new requirements_manager to hold the implementation of requrie_js and friends Sub-task Closed Tim Hunt
           
          9.
          Remove unnecessary JavaScript from bulk user enrol page Sub-task Closed Tim Hunt
           
          10.
          Allow JavaScript to set user preferences Sub-task Closed Tim Hunt
           
          11.
          Add a CSS class name to <body> when JavaScript is enabled Sub-task Closed Tim Hunt
           
          12.
          We don't need a function called uncheckall, as well as one called checknone! Sub-task Closed Tim Hunt
           
          13.
          Replace all calls to require_js with $PAGE->requries->js Sub-task Closed Tim Hunt
           
          14.
          Clean up all the places we link to javascript files, to use $PAGE->requires->js Sub-task Closed Sam Hemelryk
           
          15.
          Clean up message Javascript code Sub-task Closed Sam Hemelryk
           
          16.
          JavaScript for setting target=XX on links based on a CSS class Sub-task Closed Sam Hemelryk
           
          17.
          Modification to improve javascript and css header insertion for blocks, modules and filters Sub-task Closed Tim Hunt
           
          18.
          Split javascript-static.js into a small file included in <head> and the rest that can be included in the footer Sub-task Closed Andrew Nicols
           
          19.
          Eliminate other inline scripts Sub-task Closed Sam Hemelryk
           
          20.
          Remove inline JavaScript from backup/backup_form.html Sub-task Closed Sam Hemelryk
           
          21.
          Move tagging JavaScript out of the HTML Sub-task Closed Sam Hemelryk
           
          22.
          Clean up grader report JavaScript Sub-task Closed Andrew Davis
           
          23.
          cleanup filepicker code to require css and js before printing head Sub-task Closed Andrew Nicols
           
          24.
          Clean up lib/overlib/overlib.js if possible Sub-task Closed Sam Hemelryk
           
          25.
          Clean up lib/overlib/overlib_cssstyle.js if possible Sub-task Closed Sam Hemelryk
           
          26.
          Clean up lib/cookies.js if possible Sub-task Closed Sam Hemelryk
           
          27.
          Clean up lib/ufo.js is possible Sub-task Closed Sam Hemelryk
           
          28.
          Clean up lib/dropdown.js if possible Sub-task Closed Sam Hemelryk
           
          29.
          Search and replace code that uses the old method of focus and change it to the new Sub-task Closed Unassigned
           

            Activity

            Hide
            Eloy Lafuente (stronk7) added a comment - - edited

            I remember the IMS CP resource type also uses some "trick" to inject the needed js in the header.

            Just to open the discussion to a related thing... I think it would be great to have some standard way to add onLoad and onUnload event listeners within Moodle, instead of having custom onLoad and onUnload js code here and there.

            Edited: just for referece there are some nive addlisteners funcions (js) in : http://cvs.moodle.org/contrib/plugins/course/format/topicstree/loadunload.js?revision=1.1

            Ciao

            Show
            Eloy Lafuente (stronk7) added a comment - - edited I remember the IMS CP resource type also uses some "trick" to inject the needed js in the header. Just to open the discussion to a related thing... I think it would be great to have some standard way to add onLoad and onUnload event listeners within Moodle, instead of having custom onLoad and onUnload js code here and there. Edited: just for referece there are some nive addlisteners funcions (js) in : http://cvs.moodle.org/contrib/plugins/course/format/topicstree/loadunload.js?revision=1.1 Ciao
            Hide
            Tim Hunt added a comment -

            There are even nicer addListener funcitons in YUI, which is our recommended JS library!

            Show
            Tim Hunt added a comment - There are even nicer addListener funcitons in YUI, which is our recommended JS library!
            Hide
            Eloy Lafuente (stronk7) added a comment -

            Great! Does YUI load always?

            Show
            Eloy Lafuente (stronk7) added a comment - Great! Does YUI load always?
            Hide
            Tim Hunt added a comment -

            No, you need to do something like

            require_js(array('yui_yahoo','yui_event'));

            to load just he libraries you need - and that is what IMS CP should be doing, instead of horrible hacks. Admittedly, IMS CP and other things have been around longer than require_js has.

            Show
            Tim Hunt added a comment - No, you need to do something like require_js(array('yui_yahoo','yui_event')); to load just he libraries you need - and that is what IMS CP should be doing, instead of horrible hacks. Admittedly, IMS CP and other things have been around longer than require_js has.
            Hide
            Eloy Lafuente (stronk7) added a comment -

            Yup, but it's nice to know there are newer ways to do that properly. Thanks!

            Just for reference:

            Show
            Eloy Lafuente (stronk7) added a comment - Yup, but it's nice to know there are newer ways to do that properly. Thanks! Just for reference: Docs about js: http://docs.moodle.org/en/Development:JavaScript_guidelines Discussion about js: http://moodle.org/mod/forum/discuss.php?d=106312
            Hide
            Tim Hunt added a comment -

            Editing this bug to reflect the scope of the work that needs to be done. The original task of changing to use require_js everywhere is now a subtask.

            Show
            Tim Hunt added a comment - Editing this bug to reflect the scope of the work that needs to be done. The original task of changing to use require_js everywhere is now a subtask.
            Hide
            Sam Hemelryk added a comment -

            I am going to close this issue.

            All subtasks have been closed and any further improvements should have dedicated issues created for them.

            Show
            Sam Hemelryk added a comment - I am going to close this issue. All subtasks have been closed and any further improvements should have dedicated issues created for them.

              People

              • Votes:
                2 Vote for this issue
                Watchers:
                8 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: