Hi Eric and Thanks....
my code now looks like this...
var uploadDoc="";
if(itemDetails[1]=="uploadDoc")
{
uploadDoc='<script
label="uploadable">localStorage.docTipo="temaDocumento";localStorage.fonte="'+itemDetails[0]+'";place.setAttribute("tid","Upload_PDF");place.setAttribute("popupClass","sticky");place.setAttribute("width","400px");config.macros.showPopup.click.apply(place,event);</scri'+'pt><<setIcon
Logos/smallPDF.png "" notext>'+'>';
}
display+='|'+show+'[[fonte|'+itemDetails[10]+']]{{floatright{'+uploadDoc+'<script
label="comment">localStorage.rightMenu="comment";.....
and later return "display".....everything displays perfectly but on
clicking the icon (smallPDF)....I get an error that "event is not defined"
??? But event should be defined by the browser (I am FF 32 under Windows 8).
Help...
Skye
Em quarta-feira, 1 de outubro de 2014 21h17min59s UTC-3, Eric Shulman
escreveu:
>
> On Wednesday, October 1, 2014 4:13:52 PM UTC-7, skye riquelme wrote:
>>
>> Humm....no answers....what I need to know is how to write a call to
>> showPopup macro from inside javascript.......seems it should be possible
>> and easy, but I cant get it right, and no-one is answering my question...
>>
> var popupScript="tiddler:upload_PDF label:upload width:400px
> popupClass:sticky";
> var uploadDoc='<script
> label="uploadable">localStorage.docTipo="temaDocumento";localStorage.fonte="'
> +itemDetails[0]+'";config.macros.showPopup('+popupScript+');</scri'+'pt><<setIcon
>
> Logos/smallPDF.png "" notext>>';
> display uploadDoc;
>
>
> ShowPopupPlugin doesn't provide a direct API to trigger display of an
> arbitrary popup. Rather, the handler for the <<showPopup>> macro creates a
> button (link) with certain attributes (using values it unpacks from the
> macro parameters), and then sets the "onclick" handler for that link to
> invoke the popup. However, in your case, you don't want another button
> created.. you just want to use the button created by InlineJavscriptPlugin
> to trigger the popup ShowPopupPlugin handling.
>
> The good news is that there is a way to trick the handlers to do what you
> want: in your inline script code, first set the required attributes on the
> button, and then trigger the ShowPopupPlugin click handler, using the
> button from the InlineJavascript code as the 'root' of the popup, like this:
>
> <script label="upload">
> localStorage.docTipo="...";
> localStorage.fonte="...";
> place.setAttribute("tid","GettingStarted");
> place.setAttribute("popupClass","sticky");
> place.setAttribute("width","400px");
> config.macros.showPopup.click.apply(place,event);
> </script>
>
> Notes:
> * "place" is defined by InlineJavascriptPlugin to be the button (link)
> that was clicked on
> * "event" is defined by the browser itself as part of the onclick
> processing.
> * .apply(...) allows the macro's click handler to be invoked in the
> correct context, so that it will use the button from the inline script,
> rather than the button it normally creates on it's own.
> enjoy,
> -e
> Eric Shulman
> TiddlyTools / ELS Design Studios
>
> YOUR DONATIONS ARE VERY IMPORTANT!
> HELP ME TO HELP YOU - MAKE A CONTRIBUTION TO MY "TIP JAR"...
> http://TiddlyTools.github.com/fundraising.html#MakeADonation
>
> Professional TiddlyWiki Consulting Services...
> Analysis, Design, and Custom Solutions:
> http://www.TiddlyTools.com/#Contact
>
>
--
You received this message because you are subscribed to the Google Groups
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.