Skip to content

Instantly share code, notes, and snippets.

@tkatochin
Created February 24, 2012 10:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tkatochin/1900029 to your computer and use it in GitHub Desktop.
Save tkatochin/1900029 to your computer and use it in GitHub Desktop.
Googleカレンダーで使用すると週・月以外で落ちるサンプルガジェット
<?xml version="1.0" encoding="UTF-8"?>
<Module>
<ModulePrefs title="CanvasAndPrefSetSample" author="katochin">
<Require feature="setprefs"/>
<Require feature="views"/>
</ModulePrefs>
<UserPref datatype="hidden" display_name="test" name="testPref" />
<Content type="html" view="canvas">
<![CDATA[<!DOCTYPE html>
<head>
<script type="text/javascript">
var prefs = new gadgets.Prefs();
function savePref() {
prefs.set("testPref",
document.getElementById("testPref").value);
}
function loadPref() {
document.getElementById("testPref").value =
prefs.getString("testPref");
}
</script>
</head>
<body onload="loadPref()">
<input type="text" id="testPref"/><a href="#" onclick="savePref(); return false;">Save</a>
</body>
</html>]]>
</Content>
<Content type="html" view="home">
<![CDATA[<!DOCTYPE html>
<head>
<script type="text/javascript">
function navigateTo(dest) {
var supported_views = gadgets.views.getSupportedViews();
gadgets.views.requestNavigateTo(supported_views[dest]);
};
function gotoCanvas() {
navigateTo("canvas");
};
</script>
</head>
<body>
<a href="#" onclick="gotoCanvas(); return false;">Goto Canvas</a>
</body>
</html>]]>
</Content>
</Module>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment