Browse files

Ability to correctly close the TS player [Issue #1] Added implement f…

…or closing the player window by clicking on an empty space of site
  • Loading branch information...
1 parent 3fd75bd commit 7ceec3941ba825748f73148bde39aaef4c1cd638 @adw0rd committed Feb 25, 2013
View
1 .gitignore
@@ -1,2 +1,3 @@
*.pyc
*~
+*.mo
View
BIN torrent_stream/locale/ru/LC_MESSAGES/django.mo
Binary file not shown.
View
3 torrent_stream/locale/ru/LC_MESSAGES/django.po
@@ -6,3 +6,6 @@ msgstr ""
msgid "Watch online"
msgstr "Смотреть онлайн"
+
+msgid "Are you sure you want to close the player?"
+msgstr "Вы уверены что хотите закрыть плеер?"
View
12 torrent_stream/static/torrent_stream/button.js
@@ -32,7 +32,7 @@ var torrent_stream = {
},
'attach_video_player_to_video_box': function () {
// Click to "Watch online" and setup video-player to video-box
- var video_box = document.getElementById(torrent_stream['video_box_id'])
+ var video_box = document.getElementById(torrent_stream['video_box_id']);
video_box.style.display = 'block';
video_box.innerHTML = '<img src="' + torrent_stream_config['ajax_loader'] + '" alt="Loading..." />';
@@ -68,4 +68,14 @@ document.onkeypress = function(e) {
if (e.keyCode == 27) { // ESC
torrent_stream['dettach_video_player_from_video_box']();
}
+}
+document.getElementById('torrent_stream_video_box').onclick = function() {
+ window.CLICK_TO_TS_PLAYER = true;
+}
+document.onclick = function() {
+ if (document.getElementsByClassName('ts-power').length && !window.CLICK_TO_TS_PLAYER) {
+ if (confirm(torrent_stream_config['close_player_confirm'])) {
+ torrent_stream['dettach_video_player_from_video_box']();
+ }
+ }
}
View
3 torrent_stream/templates/torrent_stream/button.html
@@ -14,7 +14,8 @@
'content_id': '{{ content_id }}',
'box_width': parseInt('{{ TORRENT_STREAM_PLAYER.width }}'),
'box_height': parseInt('{{ TORRENT_STREAM_PLAYER.height }}'),
- 'ajax_loader': '{% static "torrent_stream/ajax-loader.gif" %}'
+ 'ajax_loader': '{% static "torrent_stream/ajax-loader.gif" %}',
+ 'close_player_confirm': '{% trans "Are you sure you want to close the player?" %}'
}
</script>
<script type="text/javascript" src="{% static "torrent_stream/button.js" %}"></script>

0 comments on commit 7ceec39

Please sign in to comment.