2014-07-23 17:32:50 +08:00
|
|
|
|
define(function (require, exports, module) {
|
|
|
|
|
var port = require("./extensionPort.js");
|
2014-07-11 18:34:59 +08:00
|
|
|
|
var audio = new Audio("http://static.liebao.cn/resources/audio/music2.ogg");
|
2014-07-29 21:19:06 +08:00
|
|
|
|
var sessmgr = require("../account/sessionMgr.js");
|
2014-07-11 18:34:59 +08:00
|
|
|
|
audio.loop = true;
|
|
|
|
|
|
|
|
|
|
|
2014-07-23 17:32:50 +08:00
|
|
|
|
exports.play = function () {
|
2014-07-29 21:19:06 +08:00
|
|
|
|
if (!sessmgr.current.options || !sessmgr.current.options.soundPrompt)
|
|
|
|
|
return;
|
|
|
|
|
|
2014-07-11 18:34:59 +08:00
|
|
|
|
audio.play();
|
|
|
|
|
$("#music_controller").show();
|
|
|
|
|
};
|
|
|
|
|
|
2014-07-23 17:32:50 +08:00
|
|
|
|
exports.stop = function () {
|
2014-07-11 18:34:59 +08:00
|
|
|
|
audio.pause();
|
|
|
|
|
$("#music_controller").hide();
|
|
|
|
|
};
|
|
|
|
|
|
2014-07-29 21:19:06 +08:00
|
|
|
|
exports.notify = function (title, content) {
|
2014-07-23 17:32:50 +08:00
|
|
|
|
port.sendMessage({ action: "notify", title: title, content: content });
|
2014-09-13 15:58:20 +08:00
|
|
|
|
port.sendMessage({ action: "attention" });
|
2014-07-23 17:32:50 +08:00
|
|
|
|
}
|
|
|
|
|
|
2014-07-11 18:34:59 +08:00
|
|
|
|
$("#btn_stop_sound").click(exports.stop);
|
|
|
|
|
$("#music_controller button").click(exports.stop);
|
|
|
|
|
});
|