Check-in [90daf7698d]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Archive of very old version 1.5, in preparation for v2.0.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk | 1.5
Files: files | file ages | folders
SHA1: 90daf7698dfb6f5de1c4ce31c9ea310974e20ba2
User & Date: lmachucab 2024-01-21 15:44:56.727
Context
2024-01-22
02:30
Preparations for v2.0 and fixing code to run JS in modern DokuWiki. Leaf check-in: dbf2dca9f8 user: lmachucab tags: trunk, 1.99
2024-01-21
15:44
Archive of very old version 1.5, in preparation for v2.0. check-in: 90daf7698d user: lmachucab tags: trunk, 1.5
15:16
Archive of very old version 1.0. check-in: a8f86b8a11 user: lmachucab tags: trunk, 1.0
Changes
Unified Diff Ignore Whitespace Patch
Changes to conf/default.php.
1
2
3
4
5
6
7
8
9





10
11




12
13
14
15
16
17
18
19

<?php
/**
 * Default configuration for clock plugin
 *
 * @license:    GPL 2 (http://www.gnu.org/licenses/gpl.html)
 * @author:     Luis Machuca <luis.machuca@gulix.cl>
 */







/* clock_style controls the CSS style used */
$conf['clock_style']     = 'default';




/* clock_infopage controls the wikilink available for help/tooltip */
$conf['clock_infopage']  = ':wiki:clock';
/* font_fallback controls the CSS family used by default for the clock face */
$conf['font_fallback']   = 'monospace';
/* nojs_fallback specifies behaviour when JavaScript is not enabled */
$conf['nojs_fallback']   = false;





|
<

|


|
>
>
>
>
>
|

>
>
>
>
|

<
<
|
|
|
|
>
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
<?php
/**
 * @brief Default configuration for clock plugin

 * @license:    GPL 2 (http://www.gnu.org/licenses/gpl.html)
 * @author:     Luis Machuca Bezzaza <luis.machuca [at] gulix.cl>
 */

/* default clock object ID 
  Note 1: this can't be changed from Config Manager
  Note 2: if you change this value, you must change the IDs for 
          the CSS styles as well! (Javascript will update itself)
 */
$conf['clock_id']        = 'dw_clock_object';
/* clock_style: base CSS style used */
$conf['clock_style']     = 'default';
/* helpbar: controls whether the helpbar will be visible */
$conf['helpbar']         = 1;
/* toolbar: controls whether the toolbar will be visible - not yet used! */
$conf['toolbar']         = 0;
/* clock_infopage: wikilink for helpbar (the official plugin page if empty) */
$conf['clock_infopage']  = ':wiki:clock';


/* nojs_fallback: behaviour when JavaScript is not enabled */
$conf['nojs_fallback']   = 0;
/* font_fallback: fallback CSS family for clock font 
   (this property is currently unused) */
$conf['font_fallback']   = 'monospace';
Changes to conf/metadata.php.
1
2
3
4
5
6
7
8
9


10
11
12
13
14
15
<?php
/**
 * Configuration-manager metadata for clock plugin
 *
 * @license:    GPL 2 (http://www.gnu.org/licenses/gpl.html)
 * @author:     Luis Machuca <luis.machuca@gulix.cl>
 */

$meta['clock_style']     = array('string');


$meta['clock_infopage']  = array('string');
$meta['font_fallback']   = array('multichoice',
     '_choices'=> array('serif','sans-serif','cursive','fantasy','monospace')
     );
$meta['nojs_fallback']   = array('onoff');



|
<





>
>





<
1
2
3

4
5
6
7
8
9
10
11
12
13
14
15

<?php
/**
 * @brief Configuration-manager metadata for clock plugin

 * @license:    GPL 2 (http://www.gnu.org/licenses/gpl.html)
 * @author:     Luis Machuca <luis.machuca@gulix.cl>
 */

$meta['clock_style']     = array('string');
$meta['helpbar']         = array('onoff');
//$meta['toolbar']         = array('onoff');
$meta['clock_infopage']  = array('string');
$meta['font_fallback']   = array('multichoice',
     '_choices'=> array('serif','sans-serif','cursive','fantasy','monospace')
     );
$meta['nojs_fallback']   = array('onoff');

Changes to lang/en/settings.php.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

16
<?php
/**
 * English language for jsclock plugin
 *
 * @license:    GPL 2 (http://www.gnu.org/licenses/gpl.html)
 * @author:     Luis Machuca <luis.machuca@gulix.cl>
 */

$lang['clock_style']     = "CSS style used to decorate the clock object; defaults to <tt>clock_default</tt> included with the plugin. <br/>Alternate classes can be defined by copying the default and editing as desired into <tt>conf/userstyle.css</tt>.";

$lang['clock_infopage']  = "If set, a link to the specified <em>wiki page</em> is displayed aside the clock.<br/>Useful to, eg.: explain the feature to your users.";

$lang['font_fallback']   = "The &laquo;<em>generic family</em>&raquo; font that is applied as a fallback.<br/><strong>This feature is currently unavailable</strong>.";

$lang['nojs_fallback']   = "Controls behaviour when JavaScript is not available:<br/><ul><li>If <b>set</b>, the time returned by the server will be displayed as normal, static text.</li><li>If <b>unset</b>, the name of the clock object's <tt>id</tt> will be displayed instead of the clock.</li></ul>";




|
<

|


|
|
|
<
|
<

>

1
2
3

4
5
6
7
8
9
10

11

12
13
14
<?php
/**
 * @brief       English language for clock plugin

 * @license:    GPL 2 (http://www.gnu.org/licenses/gpl.html)
 * @author:     Luis Machuca Bezzaza <luis.machuca [at] gulix.cl>
 */

$lang['clock_style']     = "Decorate clock with this CSS style, defaults to <tt>clock_default</tt>.<br/>Check the official plugin documentation for information on styles.";
$lang['helpbar']         = "Enable/disable the help bar (plugin information and link).";
$lang['clock_infopage']  = "A link to this specified <em>wiki page</em> is displayed in the helpbar.<br/>Useful to, eg.: explain the feature to your users.";

//$lang['font_fallback']   = "The &laquo;<em>generic family</em>&raquo; font that is applied as a fallback.<br/><strong>This feature is currently unavailable</strong>.";

$lang['nojs_fallback']   = "Controls behaviour when JavaScript is not available:<br/><ul><li>If <b>set</b>, the time returned by the server will be displayed as normal, static text.</li><li>If <b>unset</b>, the name of the clock object's <tt>id</tt> will be displayed instead of the clock.</li></ul>";


Changes to lang/es/settings.php.
1
2
3
4
5
6
7
8
9
10


11

12
13
14
15
16
<?php
/**
 * Spanish language for jsclock plugin
 *
 * @license:    GPL 2 (http://www.gnu.org/licenses/gpl.html)
 * @author:     Luis Machuca <luis.machuca@gulix.cl>
 */

$lang['clock_style']     = "Nombre del estilo en CSS utilizado para decorar el reloj; por defecto asume <tt>clock_default</tt> que viene incluido con el plugin. <br/>Otras clases pueden ser definidas copiando el ejemplo a <tt>conf/userstyle.css</tt> y etidando a conveniencia.";



$lang['clock_infopage']  = "Si se especifica, es un v&iacute;nculo a la <em>p&aacute;gina wiki</em> especificada.<br/>Por ejemplo, para explicar la caracteristica a los visitantes del sitio.";


$lang['font_fallback']   = "El nombre de la &laquo;<em>familia</em>&raquo; de la utilizada para la fuente.<br/>De momento esta caracter&iacute;stica est&aacute; <strong>deshabilitada</strong>.";

$lang['nojs_fallback']   = "Especifica qu&eacute; hacer si JavaScript no se encuentra habilitado:<br/><ul><li><b>Activado</b>:, se muestra la hora del servidor de manera est&aacute;tica.</li><li><b>Desactivado</b>: se muestra solamente un mensaje con el <tt>id</tt> del reloj.</li></ul>";









|

>
>
|
>

|

|

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?php
/**
 * Spanish language for jsclock plugin
 *
 * @license:    GPL 2 (http://www.gnu.org/licenses/gpl.html)
 * @author:     Luis Machuca <luis.machuca@gulix.cl>
 */

$lang['clock_style']     = "Nombre del estilo en CSS utilizado para decorar el reloj, <tt>clock_default</tt> por defecto. <br/>Revisa la documentación oficial por más información.";

$lang['helpbar']         = "Muestra/esconde la barra de ayuda (wikienlace con información del plugin).";
//$lang['helpbar']         = "Muestra/esconde la barra de herramientas (24/PM , UTC toggle, configuración para el Administrador).";

$lang['clock_infopage']  = "Wikienlace a una página con información acerca del reloj (enlaza a la página del plugin si está vacío).<br/>Útil para explicar el reloj a los visitantes.";

//$lang['font_fallback']   = "Familia de texto CSS usada como seguro en caso que la decoración falle. <br/>De momento esta caracter&iacute;stica est&aacute; <strong>deshabilitada</strong>.";

$lang['nojs_fallback']   = "Comportamiento cuando JavaScript no se encuentra habilitado:<br/><ul><li><b>Activado</b>:, mostrar hora del servidor de manera est&aacute;tica.</li><li><b>Desactivado</b>: mostrar un mensaje con el <tt>id</tt> del reloj.</li></ul>";

Changes to script.js.
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
/**
 * Clock Plugin: Shows realtime clock
 * 
 * @file       clock/script.js
 * @brief      Show a clock in wikipage
 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
 * @author     Luis Machuca B. <luis.machuca@gulix.cl>
 * @version    1.0


 * 
 *  -----
 *  No longer in 'experimental'!

 *  -----




 *


 *  This file contains the timer script for the clock plugin.
 */





var jsclock_id= "clock_face";

function jsclock_rerun () {



  // get the current time




  var CurTime=new Date();
  var hh= CurTime.getHours();
  var mm= CurTime.getMinutes();
  var ss= CurTime.getSeconds();

  // format it as ISO 8601 text

  if (hh<=9 && hh>=0)
    hh= "0" + hh;
  if (mm<=9 && mm>=0)
    mm= "0" + mm;
  if (ss<=9 && ss>=0)
    ss= "0" + ss;


  timetext= " " + hh + ":" + mm + ":" + ss + " ";

  // assign the text to the element
  // whose id is that of the 'jsclock_id' variable


  var theElement= document.getElementById (jsclock_id);






  theElement.firstChild.nodeValue= timetext;

  // do the timeout

  setTimeout(jsclock_rerun, 1000);
}

function jsclock_init() {
  // set up a timer

  setTimeout(jsclock_rerun, 1000);

}


addInitEvent(jsclock_init);

<
<

|

|
|
>
>
|
|
|
>
|
>
>
>
>
|
>
>
|

|
>
>
>
>
|
|
<

>
>
|
>
>

>
|
|
|
|


|
<
|
<
|
<
|

>
|
|
<
<

>
|
>
>
>
>
>
|
<

|
>
|
|

|
<
>
|
>
|
>

<
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

/**


 * @file       clock/script.js
 * @brief      Javascript for the Clock Plugin
 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
 * @author     Luis Machuca Bezzaza <luis.machuca [at] gulix.cl>
 * @version    1.5
 * @date       2010-10-15
 * @link       http://www.dokuwiki.org/plugin:clock
 */

// id of the clock face. DONT CHANGE THIS UNLESS YOU KNOW WHAT YOU ARE DOING!
var jsclock_id= "clock_face";

if(!document.getElementById("dw__editform")) {
var dwClockTimer = new dwclock_(); // timer object
var dwClockDOMObject; // DOM container
}

/** 
 * @fn     dwClock
 * @brief  Constructs the timer used by the plugin
 */
function dwclock_ () {
  this.hh = 0;
  this.uh = 0;
  this.mm = 0;
  this.ss = 0;
  this.update = dwclock_update;
  }


/**
 * @fn    dwclock_update
 * @brief Updates the clock data
 */
function dwclock_update () {

  // tick the clock
  var cT  = new Date();
  var Ahh = cT.getHours();
  var Amm = cT.getMinutes();
  var Ass = cT.getSeconds();

  // format it as ISO 8601 text
  if (Ahh<=9 && Ahh>=0) Ahh= "0" + Ahh;

  if (Amm<=9 && Amm>=0) Amm= "0" + Amm;

  if (Ass<=9 && Ass>=0) Ass= "0" + Ass;

  timetext= " " + Ahh + ":" + Amm + ":" + Ass + " ";

  // assign text to element with id as 'jsclock_id' variable
  dwClockDOMObject.innerHTML= timetext;
  }



/**
 * @fn    dwclock_update
 * @brief Ticks the clock
 */
function dwclock_tick () {
  dwClockTimer.update();
  setTimeout(dwclock_tick, 500);
  }


addInitEvent( function() {
  if(document.getElementById("dw__editform")) { return; }
  dwClockDOMObject = $(jsclock_id);
  } );

addInitEvent( function() {

  if(document.getElementById("dw__editform")) { return; }
  dwclock_tick();
  } );

// end of clock/script.js


Changes to style.css.
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













































/** 
 * @file       clock/style.css
 * @brief      Default styles for the "clock" plugin
 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
  * @author     Luis Machuca B.  <luis.machuca@gulix.cl>
 * @version    1.0

 */

/**
 *  This file sets the default style for the "clock" plugin.
 *  The CSS style applied to the clock is organized as follows:
 *
 * div#clock_object.classname - the container box.
 *    This is the virtual container. Most probably you don't want to
 *    put anyting in here, except margin/padding specificatios.
 *    'classname' is the class name associated with thw style. You must
 *    copy and replace this parameter accordingly to create new styles.

 *
 *  .face - the clock face
 *    face properties, such as font-size and color, should be set here.
 *  .info - the infopage wikilink
 *    this should be left empty unless you want to re-theme the link
 *    different from your wiki template
 *  .info > a:???   - the link
 *    put here CSS for effects on hover, visited, etc.
 *  






 */






/** 

 * Style #1    : default
 * Description : a light-coloured wall-like clock
 * Features    : monospaced font, wide margin and dark borders,
 *               with the face colour following the template theme
 */

#dw_clock_object.default {
  position: relative;
  width: 120px;
  
  margin-left: 6px;
  margin-right: 6px;
  
  border: 4px inset __text_alt__;
  
  background-color: __background_alt__;
  
  }

#dw_clock_object.default .face {
  display: block;
  font-family: monospace;
  font-size: 1.5em;
  text-align: center;
  color: __text__;
  

  }

#dw_clock_object.default .info {
  float: right;
  top: 1px;
  margin-left: 4px;
  margin-right: 0;
  }












#dw_clock_object.default .info > a {


  text-decoration: blink;



  }

#dw_clock_object.default .info > a:visited {
  text-decoration: none;


  }

#dw_clock_object.default .info > a:hover {


  background-color: __background_neu__;
  border: 1px solid __text__;






  }





/**
 * Style #2    : unnamed
 * Description : some description
 * Features    : a clock using a digital clock font in yellow face in a 
 *               black background and minor shadow.
 */


/**

 * Style #3    : tv24
 * Description : "24"-like digital clock
 * Features    : a clock using a digital clock font with yellow face in a 
 *               black background and a shadow; in absence of such 
 *               font style the display downgrades to the 
 *               defined-to-exist monospaced font.
 *
 * ---Warning---
 * In order to achieve the desired effect, this style makes use of 
 * the "font-face" aspect of CSS specification, which may or may not be 
 * supported by your browser as of the time of release of this plugin.
 * **Check the plugin page for support and indications** 
 *
 * For full experience, it is _recommended_ that you download and install 
 * one of the indicated fonts using the instructions for your System.
 *
 * The full effect depends on the 'lcdd' font which is free for
 * non-commercial use; if you don't feel comfortable with the license,
 * you can omit this font and try the 'duxclock' font which is 
 * available as freeware.
 * ---End Warning---
 */


  
/**
 *  Warning: the following style uses an online,
 *  free-for-noncommercial-use, Truetype font, from URW Software.
 */
@font-face {
  font-family: lcdd;

  src: url(http://informatica.temuco.udelmar.cl/~lmachuca/lcd.ttf);
  }

/**
 *  Warning: the following style uses an online,
 *  freeware, Truetype font.
 */
@font-face {
  font-family: "Digital Readout";
  src: url(http://informatica.temuco.udelmar.cl/~lmachuca/digitalreadout/Digir___.ttf);
  }


#dw_clock_object.tv24 {
  position: relative;
  margin-left: 5px;
  margin-right: 5px;
  }

#dw_clock_object.tv24 .face {
  width: 75%;
  min-width: 6em;
  
  background-color: black;
  border: 2px solid navy;

  line-height: 20pt;
  text-align: center;
  font-family: "Digital Readout", "lcdd", monospace;
  font-size: 14pt;
  
  text-shadow: 2px 2px #404020;
  letter-spacing: 0.2em; 
  
  color: yellow;
  }

#dw_clock_object.tv24 .info {
  position: absolute;
  right: 0;
  bottom: 0; 
  border: 2px solid black;
  }

#dw_clock_object.tv24 .info:hover {
  border: 2px solid __existing__;
  }


















































|
|
>


<
|
|
|
|
|
|
<
<
>
|
<
<
<
<
<
<
<
|
>
>
>
>
>
>

>
>
>
|



>





<
|

|
<
|
<
|
<
|
<
<
<
<
|





|
>


<
<
<
<
<
|
>
>
>
>
>
>
|
>
>
>
>
|
<
>
>
|
>
>
>
|
|
|
<
>
>


|
>
>
|
|
>
>
>
>
>
>


|
>
>
|
<
<
<
<
<
<



>



|
<
|


|
<
|


|
<
|
<
|
<
|



<
<

|
|


|
>
|



|
|


|
<
<
|
|
<
<
<
<


|


<


<




<


<



|






|



>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
/** 
 * @file       clock/style.css
 * @brief      Default styles for the "clock" plugin
 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
 * @author     Luis Machuca Bezzaza  <luis.machuca [at] gulix.cl>
 * @version    1.5
 * @link       http://www.dokuwiki.org/plugin:clock
 */


/* This file sets the default style for the "clock" plugin.
 * Information available on wikipage.
 */
#dw_clock_object {
  min-width: 6em;
  padding: 0 2px;


  }








/** 
 * ---------------------------------------------------------------------
 * Style #0    : plain
 * Description : pretty plain
 * Features    : 
 * With this style the face itself is not stulized, only some layout
 * attributes are given as well as default style for the helpbar.
 */
#dw_clock_object .face.plain {
  position: relative;
  margin: 0 2em;
  }


/** 
 * ---------------------------------------------------------------------
 * Style #1    : default
 * Description : a light-coloured wall-like clock
 * Features    : monospaced font, wide margin and dark borders,
 *               with the face colour following the template theme
 */

#dw_clock_object .face.default {
  position: relative;
  /*width: 120px;*/

  margin: auto 6px;

  }






#dw_clock_object .face.default {
  display: block;
  font-family: monospace;
  font-size: 1.5em;
  text-align: center;
  color: __text__;
  border: 4px inset __text_alt__;
  background-color: __background_alt__;
  }







/**
 * ---------------------------------------------------------------------
 * Style #2    : aradio
 * Description : some description
 * Features    : a clock using a digital clock font in yellow face in a 
 *               black background and minor shadow.
 *
 * ---Warning---
 * This style makes use of CSS3 @font-face specification, 
 * which is only supported by decent (or incredible, like Opera) web browsers.
 * **Check the plugin page for support and indications** 
 *

 * For full experience, it is _recommended_ to make the typeface available  
 * to clients via a direct download link, and source that URL from here.
 * Take into consideration the licensing of the typeface, and offer a 
 * fallback or switch if it is now available at last as Freeware.
 * ---End Warning---
 */

@font-face {
  font-family: 'Atomic Clock Radio';

  src: local('Atomic Clock Radio');
  /* src: url(path/to/your/copy/of/atomicclockradio.ttf) format('truetype'); */
  }

#dw_clock_object .face.aradio {
  padding: 4px;
  padding-right: 1em;
  background-color: #c4c8ee;
  border: 2px solid #b6b6d8;
  font-family: "Atomic Clock Radio", fantasy;
  font-size: 14pt;
  text-align: right;
  letter-spacing: 0.6pt;
  text-shadow: -2px 1px #884446;
  color: #848861;
  }

#dw_clock_object .face.aradio span.sep {
  color: #808080;
  font-weight: bold;
  }








/**
 * ---------------------------------------------------------------------
 * Style #3    : tv24
 * Description : "24"-like digital clock
 * Features    : a clock using a digital clock font with yellow face in a 
 *               black background and a shadow, degrading to monospace

 *               if the digital clock is unavailable.
 *
 * ---Warning---
 * This style makes use of CSS3 @font-face specification, 

 * which is only supported by decent (or incredible, like Opera) web browsers.
 * **Check the plugin page for support and indications** 
 *
 * For full experience, it is _recommended_ to make the typeface available  

 * to clients via a direct download link, and source that URL from here.

 * Take into consideration the licensing of the typeface, and offer a 

 * fallback or switch if it is now available at last as Freeware.
 * ---End Warning---
 */



/**
 *  Warning: this defines a Truetype typeface with the following license:
 * free-for-noncommercial-use (URW Software).
 */
@font-face {
  font-family: 'lcdd';
  src: local('LCDd');
  /* src: url(path/to/your/copy/of/lcd.ttf) format('truetype'); */
  }

/**
 *  Warning: this defines a Truetype typeface with the following license:
 * freeware (????).
 */
@font-face {
  font-family: 'Digital Readout';


  src: local('Digital Readout');
  /* src: url(path/to/your/copy/of/digitalreadout.ttf) format('truetype'); */




  }

#dw_clock_object .face.tv24 {
  width: 75%;
  min-width: 6em;

  background-color: black;
  border: 2px solid navy;

  line-height: 20pt;
  text-align: center;
  font-family: "Digital Readout", "lcdd", monospace;
  font-size: 14pt;

  text-shadow: 2px 2px #404020;
  letter-spacing: 0.2em; 

  color: yellow;
  }

#dw_clock_object .face.tv24 .info {
  position: absolute;
  right: 0;
  bottom: 0; 
  border: 2px solid black;
  }

#dw_clock_object .face.tv24 .info:hover {
  border: 2px solid __existing__;
  }

/**
 * ---------------------------------------------------------------------
 * Style #4    : bluebox
 * Description : "24"-like digital clock
 * Features    : a blue box with a white typeface, shadows.
 *
 *
 * ---Warning---
 * This style makes use of CSS3 @font-face specification, 
 * which is only supported by decent (or incredible, like Opera) web browsers.
 * **Check the plugin page for support and indications** 
 *
 * For full experience, it is _recommended_ to make the typeface available  
 * to clients via a direct download link, and source that URL from here.
 * Take into consideration the licensing of the typeface, and offer a 
 * fallback or switch if it is now available at last as Freeware.
 * ---End Warning---
 */
#dw_clock_object .face.bluebox {
  width: 75%;
  max-width: 8em;
  background-color: #2222aa;
  border: 4px solid navy;
  border-radius: 6px; -moz-border-radius: 6px; -webkit-border-radius: 6px; -o-border-radius: 6px;
  line-height: 20pt;
  text-align: center;
  font-family: "Liberation", "Helvetica", cursive;
  font-size: 14pt;
  text-shadow: -1px 2px #80c080;
  text-shadow: 2px -1px #882222;
  letter-spacing: 0.2em; 
  color: #e0f0e0;
  }

/* ---------------------------------------------------------------------
 * Helpbar styling
 */
#dw_clock_object p.helpbar {
  margin: 0 2em; 
  padding: 0 0.5em;
  background-color: __background_alt__;
  border: 1px solid __existing__;
  border-radius: 6px;
  font-size: 90%;
  }
Changes to syntax.php.
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
<?php
/**
 * Clock Plugin: Shows realtime clock
 * 
 * @file       clock/syntax.php
 * @brief      Show a clock in wikipage
 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
 * @author     Luis Machuca B. <luis.machuca@gulix.cl>
 * @version    1.0
 * 
 *  -----
 *  No longer in 'experimental'!
 *  -----
 *
 *  This plugin's purpose is to display a clock using both 
 *  CSS and JavaScript techniques normally available.
 *
 *   For a live test point a decent web browser to my wiki.
 *  http://informatica.temuco.udelmar.cl/~lmachuca/dokuwiki-lucho/
 *
 *  Greetings.
 *        - Luis Machuca B. a.k.a. 'ryan.chappelle'
 */


if(!defined('DW_LF')) define('DW_LF',"\n");
 
if(!defined('DOKU_INC')) 
define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/');
if(!defined('DOKU_PLUGIN')) 
define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
require_once(DOKU_PLUGIN.'syntax.php');
 
/**
 * All DokuWiki plugins to extend the parser/rendering mechanism
 * need to inherit from this class
 */
class syntax_plugin_clock extends DokuWiki_Syntax_Plugin {
 
    /**
     * return some info
     */
    function getInfo(){
        return array(
            'author' => 'Luis Machuca B.',
            'email'  => 'luis.machuca@gulix.cl',
            'date'   => '2008-12-24',
            'name'   => 'Clock Plugin',
            'desc'   => 'Shows a JavaScript-based clock',
            'url'    => 'http://wiki.splitbrain.org/plugin:clock',
        );
    }
 
    /**
     * What kind of syntax are we?
     */
    function getType(){
        return 'substition';
    }
 
    /**
     * What can we Do?
     */
    //function getAllowedTypes() { 
    //    return array(); 
    //}
    /* A/N: getAllowedTyped is intentionally non-defined. */

 
    /**
     * Where to sort in?
     */
    function getSort(){
        return 299;
    }
 
    /**
     * What's our code layout?
     */    
    function getPType(){ 
        return 'normal'; 
    }
 
    /**
     * How do we get to the lexer?
     */
    function connectTo($mode) {
         $this->Lexer->addSpecialPattern (
         '^\{\{clock\}\}$', $mode, 'plugin_clock');
 
    }
 
    /**
     * Handle the match
     */
    function handle($match, $state, $pos, &$handler){
 
        $data= array();
        // get the clock ID and JS fallback flag
        $theCS= $this->getConf('clock_style');
        $theJS= $this->getConf('nojs_fallback');
        $theWL= $this->getConf('clock_infopage');
        // if 'nojs_fallback' is set, we get the time from the server
        // if 'clock_infopage' contains a link, we convert it

        /* compose the data array */
        $data['style']   = $theCS;
        $data['text']    = $theJS ? date('H:i:s') : $theCS;
        $data['dolink']  = !empty($theWL);
        $data['target']  = !empty($theWL) ? wl($theWL) : '';
        
        /* Are we ready yet? */

        return $data;
    }  
 
    /**
     * Create output
     */
    function render($mode, &$renderer, $data) {
        /* get the data from $data */
		static $wasrendered= false;


		if ($wasrendered == true) {







			/* already rendered: nothing to do.
			 */






			return true;
 		}



        if($mode == 'xhtml'){


            $renderer->doc .= $this->_clock_createblock_html($data);
			$wasrendered= true;
            return true;
        }
        if($mode == 'odt'){
            return false; // may be implemented in the future
        }
        /* That's all about rendering that needs to be done, at the moment */
        return false;
    }

    /**
     * From this point onwards, local (helper) functions are implemented
     */

    /** 
     * @fn          dw_clock_object_ID
     * @brief       returns ID for the clock object
     *  This function sets the name used for the ID of the clock object.
     *  It is intended to return a somewhat unique name.
     *  If you want to change it, you may also want to update 
     *  the #id tags in the 'style.css' file. 
     */
    function _get_clock_object_ID () {
        return 'dw_clock_object';
        }

    /**
     * @fn          dw_clock_object_infoelem
     * @brief       Returns the tip fot the help element
     *  This function returns the content (text) associated with the 
     *  clock object's "help link". The text here is 
     *  *not parsed by DokuWiki*.

     */
    function _get_clock_object_infoelem () {





        return '(?)';

        }







    /**
     * @fn          _clock_createblock_html
     * @brief       Creates the HTML code for the clock object.
     */
    function _clock_createblock_html($data) {
        $theStyle   = $data['style'];
        $theText    = $data['text'];
        $theDoLink  = $data['dolink'];
        $theTarget  = $data['target'];

        $codetext.= '<div id="'. $this->_get_clock_object_ID(). '"' .
                    ' class="'. $theStyle. '">';
        $codetext.= '<div id="clock_face" class="face">'. $theText.
                    '</div>'. DW_LF;

        if ($theDoLink) {
          $codetext.= '<span class="info">';
          $codetext.= '<a href="'. $theTarget. '">'. 
                      $this->_get_clock_object_infoelem(). '</a>'. 
                      '</span>';
          }
        
        $codetext.= '</div>'. DW_LF;
        return $codetext;
     }

}

 
/*?> */



<
<



|
|
|
|
<
<



<
|
|


|

<


















|

|
|
|

|
|













|
|
<
<
>





|






|















<

<


<






<
<


<







<
|

>
|
>
>
>
>
>
>
>
|
<
>
>
>
>
>
>
|
|
>
>
|
|
>
>
|
|
|

<
<
<
|
|










<
|
<


|
|


|
|
<
<
<
>

|
>
>
>
>
>
|
>

>
>
>
>
>
|





|




<
<
<
|
|
<
<
<
<
<
<
<
<
<




<
<
<
<
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




<?php
/**


 * @file       clock/syntax.php
 * @brief      Show a clock in wikipage
 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
 * @author     Luis Machuca Bezzaza <luis.machuca [at] gulix.cl>
 * @version    1.5
 * @date       2010-10-15
 * @link       http://www.dokuwiki.org/plugin:clock


 *
 *  This plugin's purpose is to display a clock using both 
 *  CSS and JavaScript techniques normally available.

 *  For a live test point a decent web browser to my wiki.
 *  http://ryan.gulix.cl/dw/desarrollo/
 *
 *  Greetings.
 *        - Luis Machuca Bezzaza a.k.a. 'ryan.chappelle'
 */


if(!defined('DW_LF')) define('DW_LF',"\n");
 
if(!defined('DOKU_INC')) 
define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/');
if(!defined('DOKU_PLUGIN')) 
define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
require_once(DOKU_PLUGIN.'syntax.php');
 
/**
 * All DokuWiki plugins to extend the parser/rendering mechanism
 * need to inherit from this class
 */
class syntax_plugin_clock extends DokuWiki_Syntax_Plugin {
 
    /**
     * return some info
     */
    function getInfo() {
        return array(
            'author' => 'Luis Machuca Bezzaza',
            'email'  => 'luis.machuca [at] gulix.cl',
            'date'   => '2010-10-15',
            'name'   => 'Clock Plugin',
            'desc'   => $this->getLang('descr'),
            'url'    => 'http://www.dokuwiki.org/plugin:clock',
        );
    }
 
    /**
     * What kind of syntax are we?
     */
    function getType(){
        return 'substition';
    }
 
    /**
     * What can we Do?
     */
    function getAllowedTypes() { 
        return array(); 


    }
 
    /**
     * Where to sort in?
     */
    function getSort(){
        return 290;
    }
 
    /**
     * What's our code layout?
     */    
    function getPType(){ 
        return 'block'; 
    }
 
    /**
     * How do we get to the lexer?
     */
    function connectTo($mode) {
         $this->Lexer->addSpecialPattern (
         '^\{\{clock\}\}$', $mode, 'plugin_clock');
 
    }
 
    /**
     * Handle the match
     */
    function handle($match, $state, $pos, &$handler){

        $data= array();

        $theCS= $this->getConf('clock_style');
        $theJS= $this->getConf('nojs_fallback');

        // if 'nojs_fallback' is set, we get the time from the server
        // if 'clock_infopage' contains a link, we convert it

        /* compose the data array */
        $data['style']   = $theCS;
        $data['text']    = $theJS ? date('H:i:s') : $theCS;


        
        /* Are we ready yet? */

        return $data;
    }  
 
    /**
     * Create output
     */
    function render($mode, &$renderer, $data) {

      static $wasrendered= false;

      if ($mode == 'xhtml') {
        if (!$wasrendered) {
          $nl   = DW_LF;
          $cid  = $this->_get_clock_object_ID();
          $html = $this->_clock_createblock_html($data);
          $hbar = ($this->getConf('helpbar')) ? $this->_get_clock_helpbar() : '';
          $renderer->doc .= <<<EOF
<div id="$cid">$nl    $html $hbar$nl    </div><!-- end clock-->
EOF;
          $wasrendered= true;

          }
        else {
          $renderer->doc.= <<<EOF
<p><a href="#$cid" class="wikilink" title="Go To Clock">&#x231a; clock</a></p>
EOF;
          }
        return true;
        }
      else if ($mode == 'odt') {
        return false; // may be implemented in the future
        }
      else if ($mode == 'text') {
        if ($wasrendered) return true;
        $text= ' ['. $this->_get_clock_object_ID(). ' '. date('H:i'). '] ';
        $renderer->doc .= $text;
        $wasrendered= true;
        return true;
        }



      /* That's all about rendering that needs to be done, at the moment */
      return false;
    }

    /**
     * From this point onwards, local (helper) functions are implemented
     */

    /** 
     * @fn          dw_clock_object_ID
     * @brief       returns ID for the clock object
     *  This function sets the name used for the ID of the clock object.

     *  If you change it, you must also update the #id tags in 'style.css'.

     */
    function _get_clock_object_ID () {
      return $this->getConf('clock_id');
      }

    /**
     * @fn          dw_clock_helpbar
     * @brief       Returns the contents of the help bar



     * The helpbar is displayed only when $conf['helpbar'] is set.
     */
    private function _get_clock_helpbar () {
      $p.= '<p class="helpbar" >';
      $link= $this->getConf('clock_infopage');
      if (empty($link) ) { // point to plugin page by default
        $info= '[[doku>plugin:clock|Clock Plugin]]';
        }
      else {
        $info= "[[$link|Info]]";
        }
      $info= p_render('xhtml', p_get_instructions($info), $info);
      $info= trim(substr($info, 4, -5)); // remove <p>, </p>
      $p.= $info;
      $p.= '</p>';       
      return $p;
      }

    /**
     * @fn          _clock_createblock_html
     * @brief       Creates the HTML code for the clock object.
     */
    private function _clock_createblock_html($data) {
        $theStyle   = $data['style'];
        $theText    = $data['text'];
        $theDoLink  = $data['dolink'];
        $theTarget  = $data['target'];



        $codetext.= '<div id="clock_face" class="'. $theStyle. ' face">'. 
                    $theText. '</div>';









        return $codetext;
     }

}