renamed webby to hypermedia
[feisty_meow.git] / hypermedia / javascript / gruntose / show_file.js
1 <script language="JavaScript1.2">
2 <!--
3
4 ////////////////////////////////////////////////////////////////////////////
5
6 // Author: Fred T. Hamster.  Open Source; distributed under GNU Public License.
7 //
8 // this is a very silly approach to being able to show a file, even if it would normally
9 // be miconstrued as an executable.  but it's better just to get the web server configured
10 // properly so you're showing the scripts in their non-live forms.
11
12 ////////////////////////////////////////////////////////////////////////////
13
14 function show_file(page_loc) {
15   var win_locn = window.location.href;
16 //alert("winlocn " + win_locn);
17   var last_slash = win_locn.lastIndexOf("/");
18 //alert("lastslash " + last_slash);
19   if (last_slash < 0) return;
20   var dir_locn = win_locn.slice(0, last_slash + 1);
21 //alert("dirlocn " + dir_locn);
22   var new_locn = "view-source:" + dir_locn + page_loc;
23 //alert("showing " + new_locn);
24   window.location = new_locn;
25 }
26
27
28 //-->
29 </script>
30