File tree Expand file tree Collapse file tree 4 files changed +23
-6
lines changed
war/src/main/webapp/scripts Expand file tree Collapse file tree 4 files changed +23
-6
lines changed Original file line number Diff line number Diff line change @@ -448,6 +448,15 @@ public static boolean useHidingPasswordFields() {
448448 return SystemProperties .getBoolean (Functions .class .getName () + ".hidingPasswordFields" , true );
449449 }
450450
451+ /**
452+ * Toggles whether to use the DOMContentLoaded event instead of window.onload for behavior script initialization.
453+ * @since TODO
454+ */
455+ @ Restricted (NoExternalUse .class )
456+ public static boolean getUseDOMContentLoaded () {
457+ return SystemProperties .getBoolean (Functions .class .getName () + ".useDOMContentLoaded" , true );
458+ }
459+
451460 /**
452461 * URL decomposed for easier computation of relevant URLs.
453462 *
Original file line number Diff line number Diff line change @@ -29,8 +29,7 @@ THE SOFTWARE.
2929
3030 <j : if test =" ${!newJobPage}" >
3131 <j : if test =" ${it.buildable}" >
32- <st : adjunct includes =" lib.hudson.project.configurable.configurable" />
33- <l : task href =" ${url}/build?delay=0sec" icon =" icon-clock icon-md" permission =" ${it.BUILD}" post =" ${!it.parameterized}" data-callback =" lib_hudson_project_configurable_build_now_callback" data-build-failure =" ${%buildFailed}" data-build-success =" ${%Build scheduled}" data-parameterized =" ${it.parameterized}" title =" ${it.buildNowText}" />
32+ <l : task href =" ${url}/build?delay=0sec" icon =" icon-clock icon-md" permission =" ${it.BUILD}" post =" ${!it.parameterized}" data-task-failure =" ${%buildFailed}" data-task-success =" ${%Build scheduled}" title =" ${it.buildNowText}" />
3433 </j : if >
3534 <j : choose >
3635 <j : when test =" ${h.hasPermission(it,it.CONFIGURE)}" >
Original file line number Diff line number Diff line change @@ -105,7 +105,8 @@ THE SOFTWARE.
105105 <head data-rooturl =" ${rootURL}" data-resurl =" ${resURL}" data-imagesurl =" ${imagesURL}" resURL =" ${resURL}"
106106 data-extensions-available =" ${extensionsAvailable}"
107107 data-crumb-header =" ${h.getCrumbRequestField()}" data-crumb-value =" ${h.getCrumb(request2)}"
108- data-unit-test =" ${h.isUnitTest}" >
108+ data-unit-test =" ${h.isUnitTest}"
109+ data-use-dom-content-loaded =" ${h.getUseDOMContentLoaded()}" >
109110 ${h.checkPermission(it,permission)}
110111 ${h.checkAnyPermission(it, permissions)}
111112
Original file line number Diff line number Diff line change @@ -81,9 +81,17 @@ var Behaviour = (function () {
8181 } ,
8282
8383 start : function ( ) {
84- Behaviour . addLoadEvent ( function ( ) {
85- Behaviour . apply ( ) ;
86- } ) ;
84+ var useDOMContentLoaded =
85+ document . head . getAttribute ( "data-use-dom-content-loaded" ) === "true" ;
86+ if ( useDOMContentLoaded && document . addEventListener ) {
87+ document . addEventListener ( "DOMContentLoaded" , function ( ) {
88+ Behaviour . apply ( ) ;
89+ } ) ;
90+ } else {
91+ Behaviour . addLoadEvent ( function ( ) {
92+ Behaviour . apply ( ) ;
93+ } ) ;
94+ }
8795 } ,
8896
8997 apply : function ( ) {
You can’t perform that action at this time.
0 commit comments