File: frames.hlx

package info (click to toggle)
hyperlatex 2.3.1-5
  • links: PTS
  • area: main
  • in suites: potato
  • size: 460 kB
  • ctags: 322
  • sloc: lisp: 2,318; sh: 172; makefile: 80; awk: 21
file content (277 lines) | stat: -rw-r--r-- 7,513 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
%% -*-latex-*-
%%
%% ``Frames'' package for Hyperlatex
%%
%% Creates a Frames & Javascript based document
%%
%% Last $Modified: Sat Apr  5 03:40:31 1997 by otfried $
%%

\typeout{************************
****  Making Frames ****
************************
}

\begin{ifoption}{}
\typeout{Cool frames}
%% We have to override two Emacs lisp definitions
\HlxEval{
(defun hyperlatex-gen-url (label-node label-number &optional current)
  (if (zerop label-number)
      (format "%s.html?%d" hyperlatex-basename label-node)
    (format "%s.html?%d#%s" hyperlatex-basename label-node
            (hyperlatex-label-string label-number label-node))))

(setq hyperlatex-a-href-format
   (concat "A TARGET=\"_top\" HREF=" hyperlatex-meta-dq
           "%s" hyperlatex-meta-dq))
}

\newcommand{\HlxFramesDescription}{
  <frameset rows="50,*" frameborder="0" border="0" framespacing="0">
     <frameset cols="4*,2*,4*" frameborder="0" border="0" framespacing="0">
       <frame name="heading" src="javascript:top.makeLeftHeading(top.isNode)"
              scrolling="no">
       <frame name="panel" src="javascript:top.makePanel(top.isNode)"
              scrolling="no">
       <frame name="heading" src="javascript:top.makeRightHeading(top.isNode)"
              scrolling="no">
     </frameset>
  <frame name="main" src="&{nodes[isNode].href + isHash};" scrolling="auto">
  </frameset>
}

\newcommand{\toppanel}{}
\newcommand{\bottompanel}{}
\end{ifoption}

\begin{ifoption}{simple}
\typeout{Simple frames}
\newcommand{\HlxFramesDescription}{
  <frameset rows="30,*" frameborder="0" border="0" framespacing="0">
  <frame name="panel" src="javascript:top.makeIntPanel()" scrolling="no">
  <frame name="main" src="&{nodes[0].href};" scrolling="auto">
  </frameset>
}

\newcommand{\toppanel}{\html{SCRIPT LANGUAGE="JavaScript"}
  if ( top.updateNodeNumber != null ) \{
    top.updateNodeNumber(\HlxNodeNumber)
  \}
\html{/SCRIPT}}

%% Important: We need to make toppanels!
%% Let's hope users don't redefine them.
\newcommand{\bottompanel}{}
\htmlpanel{1}

\end{ifoption}

%% #1 is \HlxIcons 
%% #2 is BODY with attributes
%% #3 is \htmltitle
\newcommand{\HlxFramesJavaScript}{
  function makePrevUpNext() {
    this[-1] = "Go backward to";
    this[0] = "Go up to";
    this[1] = "Go forward to";
  }
  var prevUpNext = new makePrevUpNext();

  function makeLeftHeading(nodeNum) {
    return '<#2><H2 ALIGN="left">#3</H2></BODY>';
  }

  function makeRightHeading(nodeNum) {
    if (nodeNum > 0) {
      return '<#2><H2 ALIGN="right">' + nodes[nodeNum].name +
             '</H2></BODY>';
    } else {
      return '<#2></BODY>';
    }
  }

  function makePanel(nodeNum) {
    return '<#2><CENTER>'
         + (nodeNum > 0 ? (makeLink(nodeNum, "previous", -1)
                           + makeLink(nodeNum, "up", 0)
                           + makeLink(nodeNum, "next", 1)) : "")
         + '</CENTER></BODY>';
  }

  function makeImage(bitmapName) {
    return '<IMG BORDER="0" SRC="#1'+  bitmapName + '.xbm">';
  }

  function makeLink(nodeNum, bitmapName, dir) {
    var goal = nodes[nodeNum][dir];
    if (goal < 0) {
      // there is no node in that direction
      return makeImage("grey" + bitmapName);
    } else {
      return '<A TARGET="_top" HREF="'
        + top.location.pathname 
        +  '?' + goal + '" onMouseOver="return top.mouseOver('
        +  nodeNum + "," + dir + ')" >'
        +  makeImage(bitmapName) + '</A>\n';
    }
  }

  function makeIntPanel() {
    return '<#2><CENTER>'
      + makeIntLink("greyprevious", -1)
      + makeIntLink("greyup", 0)
      + makeIntLink("greynext", 1)
      + '</CENTER></BODY>';
  }

  function makeIntLink(bitmapName, dir) {
    return '<A HREF="javascript:top.jump(' + dir
        + ')" onMouseOver="return top.mouseOver(top.nodeNumber,'
        + dir + ')" >' +  makeImage(bitmapName) + '</A>\n';
  }

  function mouseOver(cur, where) {
    var whereTo = nodes[cur][where];
    if (whereTo >= 0) {
      window.status=prevUpNext[where] + " " + nodes[whereTo].name;
      return true;
    }
    return false;
  }

  function jump(where) {
    var whereTo = nodes[nodeNumber][where];
    if ( whereTo >= 0) {
       top.frames[1].location.href = nodes[whereTo].href;
    }
  }

  var bitmaps = new Object;
  bitmaps[-1] = 'previous.xbm';
  bitmaps[0] = 'up.xbm';
  bitmaps[1] = 'next.xbm';

  function setupBitmap(curNode, where, obj) {
    var gray = "";
    if (nodes[curNode][where] < 0) {
      gray = "grey";
    }
    obj.src = obj.src.substring(0,obj.src.lastIndexOf('/') + 1)
              + gray + bitmaps[where];
  }

  var nodeNumber = 0;
  function updateNodeNumber(nodNum) {
    nodeNumber = nodNum;
    // update the bitmaps
    setupBitmap(nodeNumber, -1, top.frames[0].document.images[0]);
    setupBitmap(nodeNumber, 0, top.frames[0].document.images[1]);
    setupBitmap(nodeNumber, 1, top.frames[0].document.images[2]);
  }

  var isNode = 0;
  var isHash = top.location.hash;
  if (top.location.search != "") {
    isNode = top.location.search.substring(1);
  }

  function Node( backw, forw, prev, up, next, Name, Href) {
    this[-1] = prev; this[0] = up; this[1] = next;
    this.href = Href; this.name = Name;
  }
  var nodes = new Object;  
}

%%
%% The following code is not used now
%%

\begin{comment}
  function findNode() {
    curUrl = top.frames[1].location.pathname;
    slashIndex = curUrl.lastIndexOf("/");
    nodeHref = curUrl.substring(slashIndex + 1, curUrl.length);
    for (var nd in nodes) {
      if (nodes[nd].href == nodeHref) {
        return nd;
      }
    }
    return -1;
  }

  function jump(where) {
    var whereTo = nodes[currentNode][where];
    if ( whereTo >= 0) {
       top.frames[0].document.links[where + 1].href = nodes[whereTo].href;
       return true;
    }
    return false;    
  }

  function showProperties(obj) {
    var result = "";
    for (i in obj) {
       result = result + i + "=" + obj[i] + "\n";
    }
    alert(result);
  }    

  var bitmaps = new Object;
  bitmaps[-1] = 'previous.xbm';
  bitmaps[0] = 'up.xbm';
  bitmaps[1] = 'next.xbm';

  function setupBitmap(curNode, where, obj) {
    var gray = "";
    if (nodes[curNode][where] < 0) {
      gray = "grey";
    }
    obj.src = obj.src.substring(0,obj.src.lastIndexOf('/') + 1)
              + gray + bitmaps[where];
  }

  var currentNode = 0;

  function loadNode(nodeNum) {
    currentNode = nodeNum;
    var d = top.frames[0].document;
    d.open();
    d.writeln('<#2>');
    d.writeln('<TABLE WIDTH=100%><TR><TD ALIGN="left">');
    // htmltitle
    d.write('#3');
    d.write('</TD><TD WIDTH="10%" VALIGN="top" ALIGN="left">');
    makeLink(d, nodeNum, "previous", -1);
    makeLink(d, nodeNum, "up", 0);
    makeLink(d, nodeNum, "next", 1);
    d.write('</TD><TD WIDTH="50%" ALIGN="right">');
    d.write(nodes[nodeNum].name);
    d.writeln('</TD></TR></TABLE>');
    d.writeln('</BODY>');
    d.close();
  }
  function makeImage(d, bitmapName) {
    d.write('<IMG BORDER="0" SRC="#1');
    d.write(bitmapName);
    d.write('.xbm">');
  }

  function makeLink(d, nodeNum, bitmapName, dir) {
    var goal = nodes[nodeNum][dir];
    if (goal < 0) {
      // there is no node in that direction
      makeImage(d, "grey" + bitmapName);
    } else {
      d.write('<A TARGET="main" HREF="');
      d.write(nodes[goal].href);
      d.write('" onMouseOver="return top.mouseOver(');
      d.write(nodeNum + "," + dir);
      d.write(')" >');
      makeImage(d, bitmapName);
      d.writeln('</A>');
    }
  }

\end{comment}