pox 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 98684756f7077ea76353f47765f1204e2d8ce42c
4
+ data.tar.gz: efa34c24d09f0db234cdfcb14d6da76b290f55c3
5
+ SHA512:
6
+ metadata.gz: 021f5ceb785b4df15e053ef91f9fae23878b0582b13f0b40d5d24893ecf25bba3a9083fd8a23976a9c0d10f29b71addc80ef953e82cc20c4ca2b3481555d8c8c
7
+ data.tar.gz: af580107b68f8eba743736b8d677f818fe0d30774bf41998de1633103df98acc1143bda74f1ee67da2700a1462c7b5398c711f4da90a729b756f04e323991aef
@@ -0,0 +1,19 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ /out/
19
+ /yuidoc-bootstrap-theme/
@@ -0,0 +1,3 @@
1
+ # 0.2.0
2
+
3
+ * 新功能: $p.animate 动画函数
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in pox.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Sunteya
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,29 @@
1
+ # Pox
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'pox'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install pox
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env rake
2
+ require 'bundler'
3
+ Bundler::GemHelper.install_tasks
4
+
5
+ class Bundler::GemHelper
6
+ def rubygem_push(gem_path)
7
+ sh("gem push '#{path}' --host http://gems.bstar.wido.me")
8
+ Bundler.ui.confirm "Pushed #{name} #{version} to gems.bstar.wido.me."
9
+ end
10
+ end
@@ -0,0 +1,2 @@
1
+ require "fume/version"
2
+ require 'pox/engine' if defined?(::Rails::Engine)
@@ -0,0 +1,8 @@
1
+ module Pox
2
+ class Engine < ::Rails::Engine
3
+ initializer :after => :after_initialize do |app|
4
+ app.config.assets.precompile += [ /pox.(js|css)/ ]
5
+ app.config.assets.compress = false
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,3 @@
1
+ module Pox
2
+ VERSION = "0.2.2"
3
+ end
@@ -0,0 +1,20 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'pox/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "pox"
8
+ spec.version = Pox::VERSION
9
+ spec.authors = ["nmzhu", "gxw"]
10
+ spec.email = ["nmzhu@b-star.cn", "xwgou@b-star.cn"]
11
+ spec.summary = %q{assets for ipanel}
12
+ spec.description = %q{assets for ipanel}
13
+
14
+ spec.files = `git ls-files -z`.split("\x0")
15
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
16
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
17
+ spec.require_paths = ["lib"]
18
+
19
+ spec.add_development_dependency "rake"
20
+ end
@@ -0,0 +1,94 @@
1
+ //= require ./adaptor-default
2
+
3
+ (function() {
4
+ "use strict";
5
+
6
+
7
+ if (!window.ChannelManager) {
8
+ return;
9
+ }
10
+
11
+ var CosAgent = {
12
+
13
+ name: "cos",
14
+
15
+ keys: ({
16
+ UP: 38,
17
+ LEFT: 37,
18
+ RIGHT: 39,
19
+ DOWN: 40,
20
+ ENTER: 4097,
21
+ RETURN: 4096,
22
+
23
+ NUM_0: 48,
24
+ NUM_1: 49,
25
+ NUM_2: 50,
26
+ NUM_3: 51,
27
+ NUM_4: 52,
28
+ NUM_5: 53,
29
+ NUM_6: 54,
30
+ NUM_7: 55,
31
+ NUM_8: 56,
32
+ NUM_9: 57,
33
+
34
+ PAGE_UP: 33,
35
+ PAGE_DOWN: 34,
36
+
37
+ // MUTE: #,
38
+ // VOLUME_DEC: #,
39
+ // VOLUME_INC: #,
40
+ CHANNEL_INC: 4111,
41
+ CHANNEL_DEC: 4112,
42
+
43
+ RED :2305,
44
+ GREEN :2306,
45
+ YELLOW :2307,
46
+ BLUE :2308,
47
+
48
+ // POWER: #,
49
+ // EXIT: #,
50
+ INFO: 73,
51
+
52
+ KEY_SERVICE: 402
53
+ // KEY_TV: #,
54
+ // KEY_GUIDE: #,
55
+ // KEY_MUSIC: #
56
+ })
57
+ };
58
+ Pox.extend(Pox.Agent, CosAgent);
59
+
60
+ Pox.extend(Pox.Agent.Broadcast, {
61
+ initMediaPlayer: function() {
62
+ if (this.mediaPlayer) { return }
63
+
64
+ this.mediaPlayer = new MediaPlayer();
65
+ // var playerId = this.mediaPlayer.getPlayerInstanceID();
66
+ this.mediaPlayer.bindPlayerInstance(1);
67
+
68
+ var self = this;
69
+ Pox.leave(function() {
70
+ self.mediaPlayer.stop();
71
+ self.mediaPlayer.unbindPlayerInstance();
72
+ });
73
+ },
74
+
75
+ playChannel: function(logicalId) {
76
+ this.initMediaPlayer();
77
+ // get Channel
78
+ var channel = ChannelManager.getChannelByLogicalID(logicalId);
79
+
80
+ // get DvbService and format data source
81
+ var srv = channel.getService();
82
+ var url = "dvb://" + srv.original_network_id + "." + srv.transport_stream_id + "." + srv.service_id;
83
+ this.mediaPlayer.setMediaSource(url);
84
+
85
+ this.mediaPlayer.play();
86
+ },
87
+
88
+ screenDimension: function(left, top, width, height) {
89
+ var rect = new Rectangle(left, top, width, height); // x, y, width, height
90
+ this.mediaPlayer.setVideoDisplayArea(rect);
91
+ this.mediaPlayer.refresh();
92
+ }
93
+ });
94
+ })();
@@ -0,0 +1,175 @@
1
+ //= require ./core
2
+
3
+ (function() {
4
+ "use strict";
5
+
6
+ /** @lends Pox.Agent */
7
+ var DefaultAgent = {
8
+
9
+ /** 当前机顶盒名称 */
10
+ name: "default",
11
+
12
+ /**
13
+ * 将数字键的 char 转换成对应数字, 无效则返回 NaN
14
+ * @param {string} which
15
+ * @return {number}
16
+ */
17
+ numKey: function(which) {
18
+ switch(which) {
19
+ case this.keys.NUM_0:
20
+ return 0;
21
+ case this.keys.NUM_1:
22
+ return 1;
23
+ case this.keys.NUM_2:
24
+ return 2;
25
+ case this.keys.NUM_3:
26
+ return 3;
27
+ case this.keys.NUM_4:
28
+ return 4;
29
+ case this.keys.NUM_5:
30
+ return 5;
31
+ case this.keys.NUM_6:
32
+ return 6;
33
+ case this.keys.NUM_7:
34
+ return 7;
35
+ case this.keys.NUM_8:
36
+ return 8;
37
+ case this.keys.NUM_9:
38
+ return 9;
39
+ default:
40
+ return NaN;
41
+ }
42
+ },
43
+
44
+ /**
45
+ * 将方向键 char 转换成字符串标识 (LEFT, RIGHT, UP, DOWN)
46
+ * param {string} which
47
+ * return {string}
48
+ */
49
+ directionKey: function(which) {
50
+ switch(which) {
51
+ case $a.keys.LEFT:
52
+ return "LEFT";
53
+ case $a.keys.RIGHT:
54
+ return "RIGHT";
55
+ case $a.keys.UP:
56
+ return "UP";
57
+ case $a.keys.DOWN:
58
+ return "DOWN";
59
+ default:
60
+ return null;
61
+ }
62
+ },
63
+
64
+ /**
65
+ * 对内部文字进行反编码, 解决有些内部文字乱码问题
66
+ * param {string} msg
67
+ * return {string}
68
+ */
69
+ dencrypt: function(msg) {
70
+ return msg;
71
+ },
72
+
73
+
74
+
75
+ /**
76
+ * 键值定义
77
+ * @type KeysDefined
78
+ */
79
+ keys: ({
80
+ /**
81
+ * @typedef KeysDefined
82
+ * @prop UP 上方向键
83
+ * @prop LEFT 左方向键
84
+ * @prop RIGHT 右方向键
85
+ * @prop DOWN 下方向键
86
+ * @prop ENTER 确定键
87
+ * @prop RETURN 返回键
88
+ * @prop NUM_0 数字0键
89
+ * @prop NUM_1 数字1键
90
+ * @prop NUM_2 数字2键
91
+ * @prop NUM_3 数字3键
92
+ * @prop NUM_4 数字4键
93
+ * @prop NUM_5 数字5键
94
+ * @prop NUM_6 数字6键
95
+ * @prop NUM_7 数字7键
96
+ * @prop NUM_8 数字8键
97
+ * @prop NUM_9 数字9键
98
+ * @prop PAGE_UP 上一页键
99
+ * @prop PAGE_DOWN 下一页键
100
+ * @prop CHANNEL_INC 频道加键
101
+ * @prop CHANNEL_DEC 频道减键
102
+ * @prop INFO 信息键
103
+ */
104
+ UP: 38,
105
+ LEFT: 37,
106
+ RIGHT: 39,
107
+ DOWN: 40,
108
+ ENTER: 13,
109
+ RETURN: 8, // BACKSPACE
110
+
111
+ NUM_0: 48,
112
+ NUM_1: 49,
113
+ NUM_2: 50,
114
+ NUM_3: 51,
115
+ NUM_4: 52,
116
+ NUM_5: 53,
117
+ NUM_6: 54,
118
+ NUM_7: 55,
119
+ NUM_8: 56,
120
+ NUM_9: 57,
121
+
122
+ PAGE_UP: 219, // [
123
+ PAGE_DOWN: 221, // ]
124
+
125
+ CHANNEL_INC: 61, // -
126
+ CHANNEL_DEC: 109, // =
127
+
128
+ INFO: 73 // i
129
+ })
130
+ };
131
+
132
+ Pox.extend(Pox.Agent, DefaultAgent);
133
+
134
+ /**
135
+ * 机顶盒组播对象
136
+ * @namespace Pox.Agent.Broadcast
137
+ */
138
+ /** @lends Pox.Agent.Broadcast */
139
+ Pox.Agent.Broadcast = {
140
+ /**
141
+ * 播放直播频道
142
+ * @param {string} id
143
+ */
144
+ playChannel: function(id) {
145
+ console.log("play channel: id = " + id);
146
+ },
147
+
148
+ /**
149
+ * 获取节目单
150
+ * @param {string} id
151
+ * @return {Object}
152
+ */
153
+ nowPlaying: function(id) {
154
+ return {
155
+ "now": {
156
+ "startTime": "00:00",
157
+ "name": "program1"
158
+ },
159
+ "next": {
160
+ "startTime": "01:00",
161
+ "name": "program2"
162
+ }
163
+ }
164
+ },
165
+
166
+ /**
167
+ * 设置屏幕位置大小
168
+ * @param {number} left
169
+ * @param {number} right
170
+ * @param {number} width
171
+ * @param {number} height
172
+ */
173
+ screenDimension: function(left, top, width, height) { }
174
+ };
175
+ })();
@@ -0,0 +1,127 @@
1
+ //= require ./adaptor-default
2
+
3
+ (function() {
4
+ "use strict";
5
+
6
+ if (navigator.userAgent.toLowerCase().indexOf("ipanel") == -1) {
7
+ return;
8
+ }
9
+
10
+ var IpanelAgent = {
11
+ name: "ipanel",
12
+
13
+ dencrypt: function(msg) {
14
+ if (msg) {
15
+ return iPanel.misc.getUserCharsetStr(msg, "gb2312");
16
+ }
17
+
18
+ return msg;
19
+ },
20
+
21
+ keys: {
22
+ UP: 1,
23
+ LEFT: 3,
24
+ RIGHT: 4,
25
+ DOWN: 2,
26
+ ENTER: 13,
27
+ RETURN: 340,
28
+
29
+ RED: 832,
30
+ YELLOW: 834,
31
+
32
+ NUM_0: 48,
33
+ NUM_1: 49,
34
+ NUM_2: 50,
35
+ NUM_3: 51,
36
+ NUM_4: 52,
37
+ NUM_5: 53,
38
+ NUM_6: 54,
39
+ NUM_7: 55,
40
+ NUM_8: 56,
41
+ NUM_9: 57,
42
+
43
+ PAGE_UP: 372,
44
+ PAGE_DOWN: 373,
45
+
46
+ MUTE: 597,
47
+ VOLUME_DEC: 596,
48
+ VOLUME_INC: 595,
49
+ CHANNEL_INC: 593,
50
+ CHANNEL_DEC: 594,
51
+
52
+ POWER: 258,
53
+ EXIT: 339,
54
+ INFO: 567, // i
55
+
56
+ KEY_SERVICE: 562,
57
+ KEY_TV: 1038,
58
+ KEY_GUIDE: 513,
59
+ KEY_MUSIC: 564
60
+ }
61
+ };
62
+
63
+ Pox.extend(Pox.Agent, IpanelAgent);
64
+
65
+ Pox.extend(Pox, {
66
+ now: function() {
67
+ return new Date();
68
+ }
69
+ });
70
+
71
+ Pox.extend(Pox.Browser, {
72
+ supportWebkitTransition: true,
73
+ supportWebkitTransform: false
74
+ });
75
+
76
+ Pox.extend(Pox.Agent.Broadcast, {
77
+ playChannel: function(id) {
78
+ var channel = this._channelByUpcode(id);
79
+ if (channel) {
80
+ var service = channel.getService();
81
+ DVB.playAV(service.frequency, service.serviceId);
82
+ }
83
+ },
84
+
85
+ nowPlaying: function(id) {
86
+ try {
87
+ var channel = this._channelByUpcode(id);
88
+ if (!channel) {
89
+ return {};
90
+ }
91
+
92
+ var service = channel.getService();
93
+ if (!service) {
94
+ return {};
95
+ }
96
+
97
+ var result = {};
98
+ result["now"] = this._convertProgram(service.presentProgram);
99
+ result["next"] = this._convertProgram(service.followingProgram);
100
+ return result;
101
+ } catch(e) {
102
+ return {};
103
+ }
104
+ },
105
+
106
+ screenDimension: function(left, top, width, height) {
107
+ media.video.setPosition(left, top, width, height);
108
+ },
109
+
110
+ _convertProgram: function(data) {
111
+ var result = {};
112
+ result["name"] = iPanel.misc.getUserCharsetStr(data.name, "gb2312");
113
+ result["startTime"] = iPanel.misc.getUserCharsetStr(data.startTime, "gb2312");
114
+ return result;
115
+ },
116
+
117
+ _channelByUpcode: function(upcode) {
118
+ var user = users.currentUser;
119
+ return user.channels.getChannelByNum(upcode);
120
+ }
121
+ });
122
+
123
+ Pox.leave(function() {
124
+ try { DVB.stopAV(0); } catch(e) {}
125
+ try { media.AV.close(); } catch(e) {}
126
+ });
127
+ })();