Last active
December 10, 2015 01:38
-
-
Save jptrsn/736d66525e55d1d0da5a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8" ?> | |
<Module> | |
<ModulePrefs | |
title="List Data Type Example" | |
scrolling="true"/> | |
<UserPref name="mylist" | |
display_name="Add Terms" | |
datatype="list" /> | |
<Content type="html"> | |
<![CDATA[ | |
<div id=content_div></div> | |
<script type="text/javascript"> | |
// Get userprefs | |
var prefs = new gadgets.Prefs(); | |
// Get the array of search terms entered by the user | |
var terms = prefs.getArray("mylist"); | |
var html = ""; | |
// If the user has not added any terms yet, display message. | |
if (terms.length == 0) | |
{ | |
html += "Edit the userprefs to add terms."; | |
} | |
else { | |
html += "Your terms are:<br /><br />"; | |
for (var i = 0; i < terms.length ; i++) { | |
var term = (terms[i]); | |
html += term + "<br />"; | |
} | |
} | |
document.getElementById("content_div").innerHTML = html; | |
</script> | |
]]> | |
</Content> | |
</Module> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment