Skip to content

Commit

Permalink
Merge branch 'global-player-selector' into dev-build
Browse files Browse the repository at this point in the history
  • Loading branch information
ivan1986 committed Mar 3, 2024
2 parents 13cff38 + d2a94ae commit d772dba
Show file tree
Hide file tree
Showing 9 changed files with 74 additions and 8 deletions.
1 change: 1 addition & 0 deletions src/app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
<script id="show-detail-tpl" src="templates/show-detail.tpl" type="text/x-template"></script>
<script id="player-tpl" src="templates/player.tpl" type="text/x-template"></script>
<script id="player-chooser-tpl" src="templates/player-chooser.tpl" type="text/x-template"></script>
<script id="player-chooser-top-tpl" src="templates/player-chooser-top.tpl" type="text/x-template"></script>
<script id="loading-tpl" src="templates/loading.tpl" type="text/x-template" ></script>
<script id="initializing-tpl" src="templates/initializing.tpl" type="text/x-template" ></script>
<script id="about-tpl" src="templates/about.tpl" type="text/x-template" ></script>
Expand Down
23 changes: 15 additions & 8 deletions src/app/lib/device/generic.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,17 +153,24 @@
$('.imgplayerchoice').attr('src', el.children('img').attr('src'));
}
});

var createChooserView = function(el) {
return new ChooserView({
collection: collection,
el: el
});
};
var ChooserViewTop = ChooserView.extend({
template: '#player-chooser-top-tpl',
});

App.Device = {
Generic: Device,
Collection: collection,
ChooserView: createChooserView
ChooserView: function(el) {
return new ChooserView({
collection: collection,
el: el
});
},
ChooserViewTop: function(el) {
return new ChooserViewTop({
collection: collection,
el: el
});
},
};
})(window.App);
18 changes: 18 additions & 0 deletions src/app/lib/views/browser/filter_bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
'click .genres .dropdown-menu a': 'changeGenre',
'click .types .dropdown-menu a': 'changeType',
'click .ratings .dropdown-menu a': 'changeRating',
'click .playerchoicemenu li a': 'selectPlayer',
'click #filterbar-settings': 'settings',
'click #filterbar-tempf': 'tempf',
'click .movieTabShow': 'movieTabShow',
Expand All @@ -41,6 +42,7 @@
App.vent.on('filter-bar:render', () => {
this.render();
this.setActive(App.currentview);
this.playerChoicerDropdown();
});
},

Expand Down Expand Up @@ -203,6 +205,8 @@
}
});

this.playerChoicerDropdown();

$('.providerinfo').tooltip({
delay: {
'show': 2400,
Expand All @@ -216,6 +220,20 @@
}
},

playerChoicerDropdown: function() {
if (Settings.activateTopPlayerSelector) {
App.Device.Collection.setDevice(Settings.chosenPlayer);
App.Device.ChooserViewTop('#player-chooser-top').render();
}
},

selectPlayer: function (e) {
var player = $(e.currentTarget).parent('li').attr('id').replace('player-', '');
if (!player.match(/[0-9]+.[0-9]+.[0-9]+.[0-9]/ig)) {
AdvSettings.set('chosenPlayer', player);
}
},

focusSearch: function() {
this.$('.search input').focus();
},
Expand Down
1 change: 1 addition & 0 deletions src/app/lib/views/settings_container.js
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@
case 'alwaysFullscreen':
case 'minimizeToTray':
case 'activateTorrentCollection':
case 'activateTopPlayerSelector':
case 'activateSeedbox':
case 'activateWatchlist':
case 'activateTempf':
Expand Down
1 change: 1 addition & 0 deletions src/app/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ Settings.enableTgxtorrentSearch = true;
Settings.enableNyaaSearch = true;
Settings.activateSeedbox = true;
Settings.activateTempf = true;
Settings.activateTopPlayerSelector = true;

// Remote Control
Settings.httpApiEnabled = false;
Expand Down
12 changes: 12 additions & 0 deletions src/app/styl/views/filter_bar.styl
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,18 @@
.nav.right
margin-right: 5px

#player-chooser-top
.button
cursor: default
background: transparent
&:hover
background: transparent
.playerchoice
padding-left 15px
margin-left 8px
margin-right -5px
border-left none

.filter
padding: 10px 0 0
margin-left: 20px
Expand Down
7 changes: 7 additions & 0 deletions src/app/templates/browser/filter-bar.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,10 @@
<i id="filterbar-settings" class="fa fa-cog settings tooltipped" data-toggle="tooltip" data-placement="left" title="<%= i18n.__("Settings") %>"></i>
</li>
</ul>
<% if (Settings.activateTopPlayerSelector) { %>
<ul class="nav nav-hor right">
<li style="display:block">
<div id="player-chooser-top"></div>
</li>
</ul>
<% } %>
15 changes: 15 additions & 0 deletions src/app/templates/player-chooser-top.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<div class="button dropdown">
<div class="dropdown-toggle left playerchoice" data-toggle="dropdown">
<img class="imgplayerchoice" src="images/icons/local-icon.png"/>
<span class="caret"></span>
</div>
<ul class="dropdown-menu playerchoicemenu" role="menu">
<% _.each(items, function(item){ %>
<li id ="player-<%= item.id %>">
<a href="#"> <%= item.name %>
<img class="playerchoiceicon" src="images/icons/<%= item.type %>-icon.png"/>
</a>
</li>
<% }); %>
</ul>
</div>
4 changes: 4 additions & 0 deletions src/app/templates/settings-container.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@
<input class="settings-checkbox" name="expandedSearch" id="expandedSearch" type="checkbox" <%=(Settings.expandedSearch? "checked='checked'":"")%>>
<label class="settings-label" for="expandedSearch"><%= i18n.__("Search field always expanded") %></label>
</span>
<span>
<input class="settings-checkbox" name="activateTopPlayerSelector" id="activateTopPlayerSelector" type="checkbox" <%=(Settings.activateTopPlayerSelector? "checked='checked'":"")%>>
<label class="settings-label" for="activateTopPlayerSelector"><%= i18n.__("Show global player selector") %></label>
</span>
<span>
<div class="dropdown defaultFilters">
<p><%= i18n.__("Default Filters") %></p>
Expand Down

0 comments on commit d772dba

Please sign in to comment.