<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
        {mso-style-priority:99;
        mso-style-link:"Plain Text Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.5pt;
        font-family:Consolas;}
span.PlainTextChar
        {mso-style-name:"Plain Text Char";
        mso-style-priority:99;
        mso-style-link:"Plain Text";
        font-family:Consolas;}
span.EmailStyle19
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle20
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page Section1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body lang=EN-GB link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal><span style='color:#1F497D'>I had a good look at this...
(not that you are not absolutely right Dave)<o:p></o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'>The way I have done this is
exactly how this works in using jQuery plugins. The only difference I could
detect was in the full use of jquery as opposed to $.<o:p></o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'>There was an undefined var that
occurred on some pages that I put inside a &#8216;if&#8217; which solved the
major issue being that the code broke the JS in the IMCE file upload. I
wouln&#8217;t have thought an undefined var would break code in other modules
but there you go.<o:p></o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'>An outstanding issue now is that
the code fails if I move from jQuery 1.7 &gt; 1.8. That could well apply to
other modules as well. Most likely I&#8217;ll ignore the issue, and at some
point it will bite me again. </span><span style='font-family:Wingdings;
color:#1F497D'>J</span><span style='color:#1F497D'><o:p></o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'>Yani<o:p></o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<div>

<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'>

<p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:
"Tahoma","sans-serif"'>From:</span></b><span lang=EN-US style='font-size:10.0pt;
font-family:"Tahoma","sans-serif"'> support-bounces@drupal.org
[mailto:support-bounces@drupal.org] <b>On Behalf Of </b>Metzler, David<br>
<b>Sent:</b> Tuesday, 04 June 2013 1:24 AM<br>
<b>To:</b> support@drupal.org<br>
<b>Subject:</b> Re: [support] Jquery code revision...<o:p></o:p></span></p>

</div>

</div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal><span lang=EN-US style='color:#1F497D'>IN case no ones
responded.&nbsp; <o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='color:#1F497D'>The
Drupal.beavoirs.mybehaviorname = {attach :Mycustomdocumentreadyfunction }
&nbsp;is a direct replacement for the document.ready override. You should
always use this form in drupal to make sure that you don&#8217;t have multiple
javascript files/functions overidding document.read.&nbsp;&nbsp;&nbsp; Whether you
move the code up into&nbsp; your zeroPoint behavior or whether you create a new
behavior on the Drupal.behaviors object is a matter of code organization and
totally up to you. <o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='color:#1F497D'>Dave<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<div>

<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'>

<p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:
"Tahoma","sans-serif"'>From:</span></b><span lang=EN-US style='font-size:10.0pt;
font-family:"Tahoma","sans-serif"'> support-bounces@drupal.org
[mailto:support-bounces@drupal.org] <b>On Behalf Of </b>Yani<br>
<b>Sent:</b> Friday, May 31, 2013 7:32 PM<br>
<b>To:</b> support@drupal.org<br>
<b>Subject:</b> [support] Jquery code revision...<o:p></o:p></span></p>

</div>

</div>

<p class=MsoNormal><span lang=EN-US><o:p>&nbsp;</o:p></span></p>

<p class=MsoPlainText><span lang=EN-AU>I need a hint on this... I've mentioned
it before but couldn't get my head around it and put it in the too hard basket.
Of course it has come back and bitten me again.<o:p></o:p></span></p>

<p class=MsoPlainText><span lang=EN-AU style='color:black'><o:p>&nbsp;</o:p></span></p>

<p class=MsoPlainText><span lang=EN-AU style='color:black'>What's happening is
my JS code is causing some other code to break.<o:p></o:p></span></p>

<p class=MsoPlainText><span lang=EN-AU style='color:black'><o:p>&nbsp;</o:p></span></p>

<p class=MsoPlainText><span lang=EN-AU style='color:black'>There are 2 ways
I've used the JS...<o:p></o:p></span></p>

<p class=MsoPlainText><span lang=EN-AU style='color:black'><o:p>&nbsp;</o:p></span></p>

<div class=MsoNormal align=center style='text-align:center'><span lang=EN-AU
style='font-size:10.5pt;font-family:Consolas;color:black'>

<hr size=2 width="100%" align=center>

</span></div>

<p class=MsoPlainText><span lang=EN-AU style='color:black'><br>
<br>
(function($) {<o:p></o:p></span></p>

<p class=MsoPlainText><span lang=EN-AU style='color:black'>&nbsp;
Drupal.behaviors.zeroPoint = {<o:p></o:p></span></p>

<p class=MsoPlainText><span lang=EN-AU style='color:black'>&nbsp;&nbsp;&nbsp;
attach : function(context, settings) {<o:p></o:p></span></p>

<p class=MsoPlainText><span lang=EN-AU style='color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
//Drupal Jquery wrapper<o:p></o:p></span></p>

<p class=MsoPlainText><span lang=EN-AU style='color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<o:p></o:p></span></p>

<p class=MsoPlainText><span lang=EN-AU style='color:black'><o:p>&nbsp;</o:p></span></p>

<p class=MsoPlainText><b><i><span lang=EN-AU style='color:black'>Button items
in here that call functions<o:p></o:p></span></i></b></p>

<p class=MsoPlainText><span lang=EN-AU style='color:black'><o:p>&nbsp;</o:p></span></p>

<p class=MsoPlainText><span lang=EN-AU style='color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
//end wrapper<o:p></o:p></span></p>

<p class=MsoPlainText><span lang=EN-AU style='color:black'>&nbsp;&nbsp;&nbsp; }<o:p></o:p></span></p>

<p class=MsoPlainText><span lang=EN-AU style='color:black'>&nbsp; }<o:p></o:p></span></p>

<p class=MsoPlainText><span lang=EN-AU style='color:black'>})(jQuery);<o:p></o:p></span></p>

<p class=MsoPlainText><span lang=EN-AU style='color:black'>// Note the wrapper
is different for Drupal Behaviors<o:p></o:p></span></p>

<p class=MsoPlainText><span lang=EN-AU style='color:black'><o:p>&nbsp;</o:p></span></p>

<div class=MsoNormal align=center style='text-align:center'><span lang=EN-AU
style='font-size:10.5pt;font-family:Consolas;color:black'>

<hr size=2 width="100%" align=center>

</span></div>

<p class=MsoPlainText><span lang=EN-AU style='color:black'>&nbsp;<o:p></o:p></span></p>

<p class=MsoPlainText><span lang=EN-AU style='color:black'>function
manageBlocks(menu) {( function($) {<o:p></o:p></span></p>

<p class=MsoPlainText><span lang=EN-AU style='color:black'>&nbsp;&nbsp;&nbsp;
$(document).ready(function() {<o:p></o:p></span></p>

<p class=MsoPlainText><span lang=EN-AU style='color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// jQuery wrapper<o:p></o:p></span></p>

<p class=MsoPlainText><span lang=EN-AU style='color:black'><o:p>&nbsp;</o:p></span></p>

<p class=MsoPlainText><b><i><span lang=EN-AU style='color:black'>Functions
actions in here<o:p></o:p></span></i></b></p>

<p class=MsoPlainText><span lang=EN-AU style='color:black'><o:p>&nbsp;</o:p></span></p>

<p class=MsoPlainText><span lang=EN-AU style='color:black'>&nbsp;&nbsp;&nbsp;&nbsp;
//end wrapper<o:p></o:p></span></p>

<p class=MsoPlainText><span lang=EN-AU style='color:black'>&nbsp;&nbsp;&nbsp;
});<o:p></o:p></span></p>

<p class=MsoPlainText><span lang=EN-AU style='color:black'>&nbsp; })(jQuery);<o:p></o:p></span></p>

<p class=MsoPlainText><span lang=EN-AU style='color:black'>}<o:p></o:p></span></p>

<p class=MsoPlainText><span lang=EN-AU style='color:black'><o:p>&nbsp;</o:p></span></p>

<div class=MsoNormal align=center style='text-align:center'><span lang=EN-AU
style='font-size:10.5pt;font-family:Consolas;color:black'>

<hr size=2 width="100%" align=center>

</span></div>

<p class=MsoPlainText><span lang=EN-AU style='color:black'><o:p>&nbsp;</o:p></span></p>

<p class=MsoPlainText><span lang=EN-AU style='color:black'>Can I just lift the
functions up and place them within the top section or do I need to write the
bottom section differently.<o:p></o:p></span></p>

<p class=MsoPlainText><span lang=EN-AU style='color:black'><o:p>&nbsp;</o:p></span></p>

<p class=MsoPlainText><span lang=EN-AU style='color:black'>It just seems odd
that this wouldn&#8217;t be correct as is.<o:p></o:p></span></p>

<p class=MsoPlainText><span lang=EN-AU style='color:black'><o:p>&nbsp;</o:p></span></p>

<p class=MsoPlainText><span lang=EN-AU style='color:black'>The sort of things
it impacts are Facebook blocks that don&#8217;t update and the file upload MCE
losses all JS abilities. <o:p></o:p></span></p>

<p class=MsoPlainText><span lang=EN-AU style='color:black'><o:p>&nbsp;</o:p></span></p>

<p class=MsoPlainText><b><span lang=EN-AU style='color:black'>Note...
it&#8217;s been 12 months since I&#8217;ve touched this and I&#8217;m most
brain dead on it!<o:p></o:p></span></b></p>

<p class=MsoPlainText><span lang=EN-AU style='color:black'><o:p>&nbsp;</o:p></span></p>

<p class=MsoPlainText><span lang=EN-AU style='color:black'><o:p>&nbsp;</o:p></span></p>

<p class=MsoPlainText><span lang=EN-AU style='color:black'>Yani<o:p></o:p></span></p>

</div>

</body>

</html>