add clock widget and correct some doco
This commit is contained in:
parent
61f47cd5ed
commit
d58abc0230
@ -98,9 +98,9 @@ Widgets are executable apps provided by the system which you can place on your p
|
||||
|
||||
|
||||
|
||||
Widgets and arguments are specified with the 'widget' and 'arg' tags.
|
||||
Widgets and arguments are specified with the 'widget' and 'var' tags.
|
||||
|
||||
[widget=recent_visitors][arg=count]24[/arg][/widget]
|
||||
[widget=recent_visitors][var=count]24[/var][/widget]
|
||||
|
||||
This loads the "recent_visitors" widget and supplies it with the argument "count" set to "24".
|
||||
|
||||
@ -136,8 +136,8 @@ Please note that pasting this example into a layout page is not likely to do any
|
||||
[menu]myfavouritemenu[/menu]
|
||||
|
||||
[widget=recent_visitors]
|
||||
[arg=count]24[/arg]
|
||||
[arg=names_only]1[/arg]
|
||||
[var=count]24[/var]
|
||||
[var=names_only]1[/var]
|
||||
[/widget]
|
||||
|
||||
[widget=tagcloud][/widget]
|
||||
|
@ -4,6 +4,10 @@ Core Widgets
|
||||
Some/many of these widgets have restrictions which may restrict the type of page where they may appear or may require login
|
||||
|
||||
|
||||
* clock - displays the current time
|
||||
* args: military (1 or 0) - use 24 hour time as opposed to AM/PM
|
||||
*
|
||||
|
||||
* profile - displays a profile sidebar on pages which load profiles (pages with nickname in the URL)
|
||||
|
||||
* tagcloud - display a tagcloud of webpage items
|
||||
|
@ -111,9 +111,9 @@ Widgets are executable apps provided by the system which you can place on your p
|
||||
[/code]
|
||||
|
||||
|
||||
Widgets and arguments are specified with the 'widget' and 'arg' tags.
|
||||
Widgets and arguments are specified with the 'widget' and 'var' tags.
|
||||
[code]
|
||||
[widget=recent_visitors][arg=count]24[/arg][/widget]
|
||||
[widget=recent_visitors][var=count]24[/var][/widget]
|
||||
[/code]
|
||||
|
||||
This loads the "recent_visitors" widget and supplies it with the argument "count" set to "24".
|
||||
@ -150,8 +150,8 @@ The 'comment' tag is used to delimit comments. These comments will not appear on
|
||||
[menu]myfavouritemenu[/menu]
|
||||
|
||||
[widget=recent_visitors]
|
||||
[arg=count]24[/arg]
|
||||
[arg=names_only]1[/arg]
|
||||
[var=count]24[/var]
|
||||
[var=names_only]1[/var]
|
||||
[/widget]
|
||||
|
||||
[widget=tagcloud][/widget]
|
||||
|
@ -649,4 +649,60 @@ function widget_item($arr) {
|
||||
$o .= prepare_page($r[0]);
|
||||
return $o;
|
||||
|
||||
}
|
||||
|
||||
function widget_clock($arr) {
|
||||
|
||||
$miltime = 0;
|
||||
if(isset($arr['military']) && $arr['military'])
|
||||
$miltime = 1;
|
||||
|
||||
$o = <<< EOT
|
||||
<div class="widget">
|
||||
<h3 class="clockface"></h3>
|
||||
<script>
|
||||
|
||||
var timerID = null
|
||||
var timerRunning = false
|
||||
|
||||
function stopclock(){
|
||||
if(timerRunning)
|
||||
clearTimeout(timerID)
|
||||
timerRunning = false
|
||||
}
|
||||
|
||||
function startclock(){
|
||||
stopclock()
|
||||
showtime()
|
||||
}
|
||||
|
||||
function showtime(){
|
||||
var now = new Date()
|
||||
var hours = now.getHours()
|
||||
var minutes = now.getMinutes()
|
||||
var seconds = now.getSeconds()
|
||||
var military = $miltime
|
||||
var timeValue = ""
|
||||
if(military)
|
||||
timeValue = hours
|
||||
else
|
||||
timeValue = ((hours > 12) ? hours - 12 : hours)
|
||||
timeValue += ((minutes < 10) ? ":0" : ":") + minutes
|
||||
// timeValue += ((seconds < 10) ? ":0" : ":") + seconds
|
||||
if(! military)
|
||||
timeValue += (hours >= 12) ? " P.M." : " A.M."
|
||||
$('.clockface').html(timeValue)
|
||||
timerID = setTimeout("showtime()",1000)
|
||||
timerRunning = true
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
startclock();
|
||||
});
|
||||
|
||||
</script>
|
||||
</div>
|
||||
EOT;
|
||||
return $o;
|
||||
|
||||
}
|
Reference in New Issue
Block a user