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: |
90daf7698dfb6f5de1c4ce31c9ea3109 |
| 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
Changes to conf/default.php.
1 2 | <?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 |
<?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 | <?php /** | | < > > < | 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 | <?php /** | | < | | | | < | < > | 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 «<em>generic family</em>» 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 | <?php /** * Spanish language for jsclock plugin * * @license: GPL 2 (http://www.gnu.org/licenses/gpl.html) * @author: Luis Machuca <luis.machuca@gulix.cl> */ | | > > | > | | | 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ística está <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ática.</li><li><b>Desactivado</b>: mostrar un mensaje con el <tt>id</tt> del reloj.</li></ul>"; |
Changes to script.js.
1 | /** | < < | | | > > | | | > | > > > > | > > | | > > > > | | < > > | > > > | | | | | < | < | < | > | | < < > | > > > > > | < | > | | | < > | > | > < | 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 | /** * @file clock/style.css * @brief Default styles for the "clock" plugin * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) | | | > < | | | | | | < < > | < < < < < < < | > > > > > > > > > | > < | | < | < | < | < < < < | | > < < < < < | > > > > > > | > > > > | < > > | > > > | | | < > > | > > | | > > > > > > | > > | < < < < < < > | < | | < | | < | < | < | < < | | | > | | | | < < | | < < < < | < < < < | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | <?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 |
<?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">⌚ 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;
}
}
|