[wp-trac] [WordPress Trac] #31785: admin_footer

WordPress Trac noreply at wordpress.org
Fri Mar 27 20:06:39 UTC 2015


#31785: admin_footer
----------------------------+------------------------------
 Reporter:  Mikayel         |       Owner:
     Type:  defect (bug)    |      Status:  new
 Priority:  normal          |   Milestone:  Awaiting Review
Component:  Administration  |     Version:  4.1.1
 Severity:  normal          |  Resolution:
 Keywords:                  |     Focuses:
----------------------------+------------------------------

Comment (by Mikayel):

 Replying to [comment:5 MattyRob]:
 > I'm presuming this javascript is supposed to add a class to the body tag
 - right?
 >
 > If I paste the code directly into the wp-admin/admin-footer.php file,
 that class does not get added for me.
 >
 > I can see the javascript in the page source and there are no console
 errors, the same applies if I load this via a plugin.

 Adding class to body can be added by jQuery, it is not the problem, the
 problem is dojo dijit that I am using in different custom plugins for
 different clients.


 if you remove flowing code from my code it will trow erros in most cases
 {{{
 if (!is_curent_plugin()) {
                 return;
         }
 }}}



 If you add the flowing code in any plugin you can see the error when you
 are in wp-admin.


 {{{

 function my_custom_js() {
 echo  ' <script
 src="//ajax.googleapis.com/ajax/libs/dojo/1.8.0/dojo/dojo.js" data-dojo-
 config="parseOnLoad: true"></script> ';

 echo  '<script type="text/javascript">
 <!--
         dojo.require("dojox.validate");
         dojo.require("dojox.validate.web");
         dojo.require("dojox.validate.us");
         dojo.require("dojox.validate.check");
         dojo.require("dijit.form.TextBox");
         dojo.require("dijit.form.ValidationTextBox");
         dojo.require("dijit.form.NumberTextBox");
         dojo.require("dijit.form.ComboBox");
         dojo.require("dijit.form.DateTextBox");
         dojo.require("dijit.dijit");
         dojo.require("dojo.parser");

         dojo.addOnLoad(function(){
                 alert("Hi Dojo");
         });
 //--></script>
 ';
 }
 add_action('admin_footer', 'my_custom_js', 100);


 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/31785#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list