Static Page JS Protocol: Difference between revisions

From genomewiki
Jump to navigationJump to search
(New page: Category:Browser QACategory:Browser Development To solve some testing issues, there is a new procedure for hard coded links that go from hgwdev --> hgwbeta --> RR and for those t...)
 
No edit summary
Line 10: Line 10:
There are cases where it is necessary to have the RR hardcoded in the link like the link below:
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
http://genome.ucsc.edu/cgi-bin/hgTracks?org=human&position=chr22&hgt.customText=http://genome.ucsc.edu/goldenPath/help/examples/ct_example1.txt  
                                                                                ^this link can't be relative 


This becomes problematic especially when you are testing on hgwdev because the files that this links is referring to aren't on the RR.
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 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.
Line 20: Line 19:


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.
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:
Ex:
<head>
  <head>
         <script type="text/javascript" src="/js/jquery.js"></script>
         <script type="text/javascript" src="/js/jquery.js"></script>
         <script type="text/javascript" src="/js/staticDoc.js"></script>
         <script type="text/javascript" src="/js/staticDoc.js"></script>
</head>
  </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)
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&amp;position=chr22&amp;hgt.customText=http://genome.ucsc.edu/goldenPath/help/examples/ct_example4.txt"
  <a class="insideLink" href="../../cgi-bin/hgTracks?org=human&amp;position=chr22&amp;hgt.customText=http://genome.ucsc.edu/goldenPath/help/examples/ct_example4.txt"


With this class added the link on hgwdev is now:
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
  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.
Please note: the <a href=""></a> must be in lower case for this to work.
Line 41: Line 41:
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)
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">
  <a class="change" TARGET=_BLANK href="http://genome.ucsc.edu/goldenPath/help/ct_description.txt">


On hwdev this link looks like this:
On hwdev this link looks like this:


http://hgwdev.cse.ucsc.edu/goldenPath/help/ct_description.txt
  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.
Please note: the <a href=""></a> must be in lower case for this to work.

Revision as of 23:23, 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.

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.