1 /***************************************************************************
2 * Copyright (C) 2003-2004 Polytechnique.org *
3 * http://opensource.polytechnique.org/ *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the Free Software *
18 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
19 ***************************************************************************/
22 /***************************************************************************
26 // {{{ function getNow()
29 * function used to print the client's computer datetime on the page
37 if (yr
<1000) yr
+= 1900;
44 days
=new Array ("Dimanche","Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi");
45 months
=new Array ("janvier","février","mars","avril","mai","juin","juillet","août","septembre","octobre","novembre","décembre");
46 return days
[dy
]+" "+wd
+" "+months
[mh
]+" "+yr
+"<br />"+time
;
51 /***************************************************************************
55 // {{{ function popWin()
58 * function that pops an anchor
60 * @param theNode anchor the anchor we are talking about
61 * @param w int the desired width for the popup
62 * @param h int the desired height for the popup
64 function popWin(theNode
,w
,h
) {
65 window
.open(theNode
.href
, '_blank',
66 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width='+w
+',height='+h
);
70 // {{{ function auto_links()
73 * parses an html file, and update the onclik handlers for anchors that need it.
76 * - that points to another host are opened in a new window (mimic the target=_new)
77 * - of class popup(2) or popup_###x### create real popups (no url bar, ...)
78 * This function is designed to be used in <body onload="javascript:auto_links()">
80 function auto_links() {
81 nodes
= document
.getElementsByTagName('a');
83 fqdn
= fqdn
.replace(/^https?:\/\/([^\/]*)\/.*$/,'$1');
84 for(var i
=0; i
<nodes
.length
; i
++) {
86 if(!node
.href
|| node
.className
== 'xdx' || node
.href
.indexOf('mailto:') > -1 || node
.href
.indexOf('javascript:')>-1) continue;
87 if(node
.href
.indexOf(fqdn
)<0 || node
.className
== 'popup') {
88 node
.onclick
= function () { window
.open(this.href
); return false; };
90 if(node
.className
== 'popup2') {
91 node
.onclick
= function () { popWin(this,840,600); return false; };
93 if(matches
= (/^popup_([0-9]*)x([0-9]*)$/).exec(node
.className
)) {
94 var w
= matches
[1], h
= matches
[2];
95 node
.onclick
= function () { popWin(this,w
,h
); return false; };
102 /***************************************************************************
106 // {{{ function pa_onload
108 function pa_onload() {