[Gmod-help] code contribution

Ryan Doherty rdoherty at pcbi.upenn.edu
Mon Nov 21 17:06:55 EST 2011


Lincoln,

Sorry to do this but I already found a bug in my own code (in cases 
where the javascript contains a ':' character).  The following diff is 
better.

Thanks,
Ryan


*** balloon.js.v2.39    2011-11-16 16:02:55.000000000 -0500
--- balloon.js    2011-11-16 17:24:47.000000000 -0500
***************
*** 1065,1070 ****
--- 1065,1076 ----
       this.loadedFromElement = true;
     }

+   // check if the contents are to be generated by javascript
+   if (caption.match(/^javascript:/)) {
+     var jsFunctionCall = caption.substring(11);
+     caption = eval(jsFunctionCall);
+   }
+
     // check if iframes are allowed
     if (caption.match(/\<\s*iframe/i) && !this.allowIframes) {
       alert('Sorry: iframe elements '+notAllowed);
***************
*** 1087,1093 ****
     this.currentHelpText = this.getContents(caption);
     this.loadedFromElement = false;

!   return this.currentHelpText;;
   }


--- 1093,1099 ----
     this.currentHelpText = this.getContents(caption);
     this.loadedFromElement = false;

!   return this.currentHelpText;
   }






On 11/16/11 7:32 PM, Lincoln Stein wrote:
> Hi Ryan,
>
> Sorry that gbrowse2 broke your loading code. I will be happy to 
> incorporate your patch into the distribution.
>
> If you think you'll be making other improvements, Scott and I would be 
> happy to add you to the developer list at github.
>
> Lincoln
>
> On Thu, Nov 17, 2011 at 6:40 AM, Ryan Doherty <rdoherty at pcbi.upenn.edu 
> <mailto:rdoherty at pcbi.upenn.edu>> wrote:
>
>     Hello,
>
>     I am part of the eupathdb.org <http://eupathdb.org> project at the
>     University of Pennsylvania.  We are in the process of upgrading to
>     GBrowse 2 and I have been tasked with ensuring the popups continue
>     to work the way they always have.  Previously we had been
>     generating the content of the popups using a javascript function
>     call (with parameters established during the original page load).
>      I would like to continue to do it this way, but found that
>     loading popup content via a javascript function was not supported
>     in GBrowse 2 (if this is incorrect, please let me know).
>
>     I patched our local code to enable this functionality and would
>     love to pass it on so that it may be added to the next version of
>     GBrowse 2.x.  If I could be added as a project member on
>     SourceForge, perhaps I could make the change myself.  If not,
>     please consider making the following change:
>
>     Add the following lines at line 1067 of balloon.js:
>
>     >   // check if the contents are to be generated by javascript
>     >   if (caption.match(/^javascript:/)) {
>     >     var jsFunctionCall = caption.split(':')[1];
>     >     caption = eval(jsFunctionCall);
>     >   }
>     >
>
>     Doing this would allow users to customize the contents of a popup
>     using a string like "javascript:getMyPopupContent()" when
>     preferred.  The full diff and new file (patched from version 2.39)
>     are attached (with an additional minor nit).  Please feel free to
>     contact me with any questions.
>
>     Thank you,
>     Ryan Doherty
>     EuPathDb Team, University of Pennsylvania
>
>
>
>
> -- 
> Lincoln D. Stein
> Director, Informatics and Biocomputing Platform
> Ontario Institute for Cancer Research
> 101 College St., Suite 800
> Toronto, ON, Canada M5G0A3
> 416 673-8514
> Assistant: Renata Musa <Renata.Musa at oicr.on.ca 
> <mailto:Renata.Musa at oicr.on.ca>>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://brie4.cshl.edu/pipermail/gmod-help/attachments/20111121/1825cbc1/attachment.html>


More information about the Gmod-help mailing list