Commit dd7729ec authored by Xiaowu Zhang's avatar Xiaowu Zhang

add audioplayer title gadget

parent ca314ca2
...@@ -5,7 +5,14 @@ ...@@ -5,7 +5,14 @@
rJS(window).ready(function (g) { rJS(window).ready(function (g) {
// First, load the progress gadget // First, load the progress gadget
g.declareGadget('../audioplayer_progress/index.html') var div_context = g.__element.getElementsByTagName('div')[0];
g.declareGadget(
'../audioplayer_progress/index.html',
{
element: div_context
// sandbox: 'iframe'
}
)
.then(function (progress) { .then(function (progress) {
progress.setValue(50); progress.setValue(50);
progress.setMax(100); progress.setMax(100);
......
...@@ -14,11 +14,10 @@ ...@@ -14,11 +14,10 @@
<link rel="stylesheet" href="../../src/audioplayer/audioplayer.css" media="screen" ></link> <link rel="stylesheet" href="../../src/audioplayer/audioplayer.css" media="screen" ></link>
</head> </head>
<body> <body>
<progress> <div style="color:#00FF00" id="div">
<id="progress"> </div>
</progress>
......
<!DOCTYPE html>
<html lang="en">
<head>
<title>title</title>
<!-- renderjs -->
<script src="../<%= copy.rsvp.relative_dest %>" type="text/javascript"></script>
<script src="../<%= copy.renderjs.relative_dest %>" type="text/javascript"></script>
<!-- custom script -->
<script src="./title.js" type="text/javascript"></script>
<link rel="stylesheet" href="../../src/audioplayer_title/title.css" media="screen" ></link>
</head>
<body>
<form name="noticeForm" action="">
<p><input type="text" name="notice" size="40" ></p>
</form>
</body>
</html>
/*todo */
\ No newline at end of file
/*global window, rJS, RSVP, console */
/*jslint maxlen:80, nomen: true */
(function (window, rJS) {
"use strict";
var gk = rJS(window),
scroll;
function BannerObject() {
this.msg = "it's a test";
this.out = " ";
this.Position = 50;
this.pos = this.Position;
this.delay = 100;
this.i = 0;
this.size = 0;
this.reset = function () {
this.pos = this.Position;
};
}
gk.declareMethod('setMessage', function (msg) {
scroll.msg = msg;
})
.declareMethod('setDelay', function (delay) {
scroll.delay = delay;
})
.declareMethod('setPosition', function (position) {
if (position > this.size) {
position = this.size;
}
scroll.Position = position;
})
.declareMethod('setMaxSize', function (size) {
this.input.size = size;
scroll.size = size;
});
gk.ready(function (g) {
scroll = new BannerObject();
g.input = g.__element.getElementsByTagName('input')[0];
scroll.size = g.input.size;
function scroller() {
scroll.out += " ";
if (scroll.pos > 0) {
for (scroll.i = 0; scroll.i < scroll.pos; scroll.i += 1) {
scroll.out += " ";
}
}
if (scroll.pos >= 0) {
scroll.out += scroll.msg;
} else {
scroll.out = scroll.msg.substring(-scroll.pos,
scroll.msg.length);
}
g.input.value = scroll.out;
scroll.out = " ";
scroll.pos -= 2;
if (scroll.pos < -(scroll.msg.length)) {
scroll.reset();
}
}
window.setInterval(function () {
scroller();
}, scroll.delay);
});
}(window, rJS));
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment