Skip to content

Commit 018cf1e

Browse files
authored
Merge pull request #79 from emrysr/dark-sidebar-mobile-resize-2
Dark sidebar mobile resize 2
2 parents 4dd7450 + 04d140f commit 018cf1e

File tree

21 files changed

+1254
-990
lines changed

21 files changed

+1254
-990
lines changed

Lib/config.js

Lines changed: 59 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ var config = {
1717

1818
// Check that the config is complete first otherwise show config interface
1919
if (!config.check()) {
20-
$("#app-setup").show(); // Show setup block
20+
config.showConfig(); // Show setup block
2121
$(".ajax-loader").hide(); // Hide AJAX loader
2222
config.UI(); // Populate setup UI options
2323
} else {
@@ -29,18 +29,21 @@ var config = {
2929
config.initialized = true; // Init app
3030
config.showapp();
3131
}
32-
33-
$("body").on("click",".openconfig",function(){
34-
$("#app-block").hide();
35-
$("#app-setup").show();
32+
33+
$("body").on("click", ".openconfig", function(event){
34+
config.showConfig();
3635
config.UI();
37-
config.hideapp();
3836
});
3937

40-
$("body").on("click",".launchapp",function(){
38+
// don't save and just show app
39+
$("body").on("click",".close-config", function(event){
40+
config.closeConfig();
41+
});
42+
43+
// save and show app
44+
$("body").on("click", ".launchapp", function(){
4145
$(".ajax-loader").show();
42-
$("#app-setup").hide();
43-
$("#app-block").show();
46+
config.closeConfig();
4447
config.load();
4548
if (!config.initialized) { config.initapp(); config.initialized = true; }
4649
config.showapp();
@@ -65,6 +68,31 @@ var config = {
6568
});
6669
});
6770
},
71+
/**
72+
* hide the app config window and show the app.
73+
* enable the buttons in the app header
74+
*/
75+
closeConfig: function () {
76+
$("#app-block").toggleClass('hide', false).show();
77+
78+
$("#app-setup").toggleClass('hide', true);
79+
80+
$('.openconfig').toggleClass('hide', false);
81+
$('.close-config').toggleClass('hide', true);
82+
$('#buttons #tabs .btn').attr('disabled',false).css('opacity',1);
83+
},
84+
/**
85+
* hide the app window and show the config window.
86+
* disable the buttons in the app header
87+
*/
88+
showConfig: function () {
89+
$("#app-block").toggleClass('hide', true);
90+
$("#app-setup").toggleClass('hide', false).show();
91+
92+
$('.openconfig').toggleClass('hide', true);
93+
$('.close-config').toggleClass('hide', false);
94+
$('#buttons #tabs .btn').attr('disabled',true).css('opacity',.2);
95+
},
6896

6997
UI: function() {
7098
$(".app-config").html("");
@@ -111,9 +139,16 @@ var config = {
111139
// Create list of feeds that satisfy engine requirement
112140
var out = "<option value=0>Select "+z+" feed:</option>";
113141
out += "<option value=auto>AUTO SELECT</option>";
114-
for (var n in config.feedsbyname) {
115-
if (config.engine_check(config.feedsbyname[n],config.app[z])) {
116-
out += "<option value="+config.feedsbyname[n].id+">"+config.feedsbyname[n].name+"</option>";
142+
var sortedFeeds = [];
143+
for (var n in config.feedsbyname) {
144+
let feed = config.feedsbyname[n];
145+
feed.longname = config.feedsbyname[n].tag+":"+config.feedsbyname[n].name;
146+
sortedFeeds.push(feed);
147+
}
148+
sortedFeeds.sort(config.sortByLongname)
149+
for (var n in sortedFeeds) {
150+
if (config.engine_check(sortedFeeds[n],config.app[z])) {
151+
out += "<option value="+sortedFeeds[n].id+">"+sortedFeeds[n].tag+":"+sortedFeeds[n].name+"</option>";
117152
}
118153
}
119154
configItem.find(".feed-select").html(out);
@@ -336,9 +371,19 @@ var config = {
336371
result = JSON.parse(result);
337372
if (result.success!=undefined && !result.success) app_log("ERROR",result.message);
338373
} catch (e) {
339-
app.log("ERROR","Could not parse /setconfig reply, error: "+e);
374+
try {
375+
app.log("ERROR","Could not parse /setconfig reply, error: "+e);
376+
} catch (e2) {
377+
console.log(e,e2);
378+
}
340379
}
341380
}
342381
});
382+
},
383+
384+
sortByLongname: function(a, b){
385+
var aName = a.longname.toLowerCase();
386+
var bName = b.longname.toLowerCase();
387+
return ((aName < bName) ? -1 : ((aName > bName) ? 1 : 0));
343388
}
344-
}
389+
}

Views/app_view.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525

2626
</style>
2727

28-
<div style="height:10px"></div>
29-
3028
<div style="padding:20px">
3129

3230
<h2>Available Apps</h2>
@@ -92,8 +90,7 @@
9290
app_new_enable = false;
9391
setTimeout(function(){ app_new_enable = true; }, 500);
9492
$('#app-new-modal').modal('hide');
95-
var nicename = $("#app-new-name").val();
96-
93+
var nicename = escape($("#app-new-name").val()).replace(/%20/g, "+");
9794
$.ajax({
9895
url: path+"app/add?name="+nicename+"&app="+selected_app,
9996
dataType: 'json',

Views/css/config.css

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
#app-setup {
2-
padding:20px;
3-
display:none;
4-
}
51

62
.app-config {
73
width:30%;

0 commit comments

Comments
 (0)