Follow these steps to install this script on your wiki.
http://wiki.developer.mindtouch.com/@api/deki/files/3100/=popup.xmlRelated Links: DekiScript service, Extension Overview, DekiScript Overview, Extension Demos.
Produces various popup windows from within the wiki This script requires MindTouch Deki 1.8.3 or later.
Functions:
Generate popup window from div embedded on wiki page
Parameters:
| Name | Type | Description |
| divID | str | Name of div to put in popup |
| label | str | Link text |
| height | num | (optional) Height of popup window (default=300) |
| width | num | (optional) Width of popup window (default=200) |
Generate popup window with list passed to extension
Parameters:
| Name | Type | Description |
| header | str | text to put before the list of values |
| valueList | list | list of stuff to put in popup |
| label | str | Link text |
| height | num | (optional) Height of popup window (default=300) |
| width | num | (optional) Width of popup window (default=200) |
<extension>
<title>Popup</title>
<description>Produces various popup windows from within the wiki</description>
<namespace>popup</namespace>
<function>
<name>div</name>
<description>Generate popup window from div embedded on wiki page</description>
<param name="divID" type="str">Name of div to put in popup</param>
<param name="label" type="str">Link text</param>
<param name="height" type="num" optional="true">Height of popup window (default=300)</param>
<param name="width" type="num" optional="true">Width of popup window (default=200)</param>
<return>
<html xmlns:eval="http://mindtouch.com/2007/dekiscript">
<head>
<script type="text/javascript">
function doPopup_<eval:expr>@id</eval:expr>() {
var h = <eval:js>args.height ?? 300</eval:js>;
var w = <eval:js>args.width ?? 200</eval:js>;
var popwin = window.open("","deki_popup","scrollbars=1,height="+h+",width="+w);
popwin.document.write(document.getElementById(<eval:js>args.divID</eval:js>).innerHTML);
popwin.document.close();
popwin.focus();
return false;
}
</script>
</head>
<body>
<a href="#" eval:onClick="'return doPopup_'..@id..'();'" class="internal">
<eval:expr>args.label</eval:expr></a>
</body>
<tail>
<script type="text/javascript">
document.getElementById(<eval:js>args.divID</eval:js>).style.display = "none";
</script>
</tail>
</html>
</return>
</function>
<function>
<name>list</name>
<description>Generate popup window with list passed to extension</description>
<param name="header" type="str">text to put before the list of values</param>
<param name="valueList" type="list">list of stuff to put in popup</param>
<param name="label" type="str">Link text</param>
<param name="height" type="num" optional="true">Height of popup window (default=300)</param>
<param name="width" type="num" optional="true">Width of popup window (default=200)</param>
<return>
<html xmlns:eval="http://mindtouch.com/2007/dekiscript">
<head>
<script type="text/javascript">
function doPopup_<eval:expr>@id</eval:expr>() {
var h = <eval:js>args.height ?? 300</eval:js>;
var w = <eval:js>args.width ?? 200</eval:js>;
var popwin = window.open("","deki_popup","scrollbars=1,height="+h+",width="+w);
popwin.document.write(<eval:js>(args.header ?? "") .. "<ul>"</eval:js>);
<eval:foreach var="text" in="args.valueList">
popwin.document.write(<eval:js>"<li>"..text.."</li>"</eval:js>);
</eval:foreach>
popwin.document.write("</ul>");
popwin.document.close();
popwin.focus();
return false;
}
</script>
</head>
<body>
<a href="#" eval:onClick="'return doPopup_'..@id..'();'" class="internal">
<eval:expr>args.label</eval:expr></a>
</body>
<tail>
</tail>
</html>
</return>
</function>
</extension>
To pop up a simple list:
{{ popup.list("This is a list:", ["1", "2", "three"], "click to pop!", 200,200) }}
To pop up a list of first 20 users on this wiki:
{{ popup.list("Users:", web.list(uri.build(site.api,"users",{ limit:20 })), "show users!", 200, 500) }}
To show the list of functions in this extension:
{{ popup.list("Functions in 'Popup' extension:", web.list("http://wiki.developer.mindtouch.com/@api/deki/files/3100/=popup.xml","/extension/function/name"), "show functions!", 100, 300) }}