Static Page JS Protocol: Difference between revisions

From genomewiki
Jump to navigationJump to search
No edit summary
No edit summary
Line 15: Line 15:


To solve this problem I wrote/found some jquery code (/js/staticDoc.js) that will find hard coded "http://genome.ucsc.edu" links and rewrite them to be whatever their current host name is for easy testing.
To solve this problem I wrote/found some jquery code (/js/staticDoc.js) that will find hard coded "http://genome.ucsc.edu" links and rewrite them to be whatever their current host name is for easy testing.
To see this code in action, hover over the "here" under example one for each of these:
  http://hgwdev.cse.ucsc.edu/goldenPath/help/customTrack.html
  http://hgwbeta.cse.ucsc.edu/goldenPath/help/customTrack.html
  http://genome.ucsc.edu/goldenPath/help/customTrack.html
The html code for this is:
<P>
Click <a class="insideLink" href="../../cgi-bin/hgTracks?org=human&amp;position=chr22&amp;hgt.customText=http://genome.ucsc.edu/goldenPath/help/examples/ct_example1.txt"
TARGET=_blank>here</a> to view this track in the Genome Browser.</P>


For this to work you there are a few things you need to do:
For this to work you there are a few things you need to do:

Revision as of 23:44, 5 August 2010


To solve some testing issues, there is a new procedure for hard coded links that go from hgwdev --> hgwbeta --> RR and for those that go from hgdownload-test --> hgdownload.

Starting with the first scenario:

hgwdev --> hgwbeta --> RR

There are cases where it is necessary to have the RR hardcoded in the link like the link below:

http://genome.ucsc.edu/cgi-bin/hgTracks?org=human&position=chr22&hgt.customText=http://genome.ucsc.edu/goldenPath/help/examples/ct_example1.txt

If you look at the second part of the url you will see that this becomes problematic especially when you are testing on hgwdev because the files that this links to is referring to a file that isn't on the RR at the time of testing.

To solve this problem I wrote/found some jquery code (/js/staticDoc.js) that will find hard coded "http://genome.ucsc.edu" links and rewrite them to be whatever their current host name is for easy testing.

To see this code in action, hover over the "here" under example one for each of these:

 http://hgwdev.cse.ucsc.edu/goldenPath/help/customTrack.html
 http://hgwbeta.cse.ucsc.edu/goldenPath/help/customTrack.html
 http://genome.ucsc.edu/goldenPath/help/customTrack.html

The html code for this is:

Click <a class="insideLink" href="../../cgi-bin/hgTracks?org=human&position=chr22&hgt.customText=http://genome.ucsc.edu/goldenPath/help/examples/ct_example1.txt" TARGET=_blank>here</a> to view this track in the Genome Browser.

For this to work you there are a few things you need to do:

1) You need to refer for the jquery code by placing the code below between the <head></head> tags at the top of the page or the page that the file is included in.

Ex:

  <head>
       <script type="text/javascript" src="/js/jquery.js"></script>
       <script type="text/javascript" src="/js/staticDoc.js"></script>
  </head>

2) If the hard coded link is after an "=" sign then you will need to add class="insideLink" to the to link (see below)

  <a class="insideLink" href="../../cgi-bin/hgTracks?org=human&position=chr22&hgt.customText=http://genome.ucsc.edu/goldenPath/help/examples/ct_example4.txt"

With this class added the link on hgwdev is now:

 http://hgwdev.cse.ucsc.edu/cgi-bin/hgTracks?org=human&position=chr22&hgt.customText=http://hgwdev-vanessa.cse.ucsc.edu/goldenPath/help/examples/ct_example4.txt

Please note: the <a href=""></a> must be in lower case for this to work.

When you push it to hgwbeta, the url after the "=" sign will reflect the current host name.


3) If there is a rare case where you have to have a hard coded link instead of a relative link, then you will need to add class="change" (see below)

 <a class="change" TARGET=_BLANK href="http://genome.ucsc.edu/goldenPath/help/ct_description.txt">

On hwdev this link looks like this:

 http://hgwdev.cse.ucsc.edu/goldenPath/help/ct_description.txt


Please note: the <a href=""></a> must be in lower case for this to work.