Merge branch ‘develop’ #10
@ -1,4 +1,4 @@
|
|||||||
{{ $mode := .Get 0 }}{{ $opt := .Get 1 }}
|
{{ $mode := .Get 0 }}{{ $opt1 := .Get 1 }}{{ $opt2 := .Get 2 }}
|
||||||
|
|
||||||
{{ $img_on := ( printf "%s%s" $.Page.Site.BaseURL "img/on-off/switch-on-icon_smal.png" )}}
|
{{ $img_on := ( printf "%s%s" $.Page.Site.BaseURL "img/on-off/switch-on-icon_smal.png" )}}
|
||||||
{{ $img_off := ( printf "%s%s" $.Page.Site.BaseURL "img/on-off/switch-off-icon_smal.png" )}}
|
{{ $img_off := ( printf "%s%s" $.Page.Site.BaseURL "img/on-off/switch-off-icon_smal.png" )}}
|
||||||
@ -8,18 +8,24 @@
|
|||||||
{{ else if eq $mode "off"}}
|
{{ else if eq $mode "off"}}
|
||||||
<img src="{{ $img_off }}" alt="Off">
|
<img src="{{ $img_off }}" alt="Off">
|
||||||
{{ else if eq $mode "imgping" }}
|
{{ else if eq $mode "imgping" }}
|
||||||
{{ with $opt }}
|
{{ with $opt1 }}
|
||||||
{{ $id := md5 $opt }}
|
{{ $id := md5 $opt1 }}
|
||||||
<img id={{ $id }} src="{{ $img_off }}" alt="Off">
|
{{ if eq $opt2 "on" }}
|
||||||
|
<img id={{ $id }} src="{{ $img_on }}" alt="On">
|
||||||
|
{{ else }}
|
||||||
|
<img id={{ $id }} src="{{ $img_off }}" alt="Off">
|
||||||
|
{{ end }}
|
||||||
<script language="JavaScript">
|
<script language="JavaScript">
|
||||||
var imgping = new Image();
|
var imgping = new Image();
|
||||||
imgping.src = '{{ $opt }}';
|
imgping.src = '{{ $opt1 }}';
|
||||||
if(imgping.height>0){
|
if(imgping.height>0){
|
||||||
document.getElementById("{{ $id }}").outerHTML ='<img src="{{ $img_on }}" alt="On">';
|
document.getElementById("{{ $id }}").outerHTML ='<img src="{{ $img_on }}" alt="On">';
|
||||||
|
} else {
|
||||||
|
document.getElementById("{{ $id }}").outerHTML ='<img src="{{ $img_off }}" alt="Off">';
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
{{ else }}
|
{{ else }}
|
||||||
Ned URL to image
|
imgping [URL to image] [default on/off]
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ else }}
|
{{ else }}
|
||||||
???
|
???
|
||||||
|
Loading…
Reference in New Issue
Block a user