]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
ui: Fix createToolbar2 issues on some recent browsers.
authorE.Smith <31170571+azlm8t@users.noreply.github.com>
Tue, 18 Sep 2018 17:25:15 +0000 (18:25 +0100)
committerJaroslav Kysela <perex@perex.cz>
Thu, 20 Sep 2018 12:30:59 +0000 (14:30 +0200)
Recent versions of Firefox had an exception saying the createToolbar2
function does not exist when it was called to create the secondary
toolbar that is used for category searching in the EPG.

I believe this was due to scoping issues, so rescoped the variables.
This worked, but although the toolbar was added it was not displayed
on Firefox.  So changed the way the toolbar is added and it now works
on Firefox and Safari.

src/webui/static/app/epg.js

index 56105e8abf829633b9da0d55269183e840e31566..93b4dfa0c874496c94e84a29c7ab8a0e9384380b 100644 (file)
@@ -15,22 +15,6 @@ insertCategoryClearOption = function(scope, records, options) {
     scope.insert(0,new placeholder({key: '-1', val: _('(Clear filter)')}));
 };
 
-tvheadend.category = tvheadend.idnode_get_enum({
-    url: 'api/channelcategory/list',
-    event: 'channelcategory',
-    listeners: {
-        'load': function(scope, records, options) {
-          insertCategoryClearOption(scope, records, options);
-          // If we have categories then we create the category
-          // search toolbar.
-          if (records.length) {
-            tvheadend.createToolbar2();
-          }
-        }
-    }
-});
-
-
 tvheadend.contentGroupLookupName = function(code) {
     ret = "";
     if (!code)
@@ -838,6 +822,20 @@ tvheadend.epg = function() {
 
     });
 
+  var category = tvheadend.idnode_get_enum({
+    url: 'api/channelcategory/list',
+    event: 'channelcategory',
+    listeners: {
+        'load': function(scope, records, options) {
+          insertCategoryClearOption(scope, records, options);
+          // If we have categories then we create the category
+          // search toolbar.
+          if (records.length) {
+            createToolbar2();
+          }
+        }
+    }});
+
     /// "cat" is the name of the category field.
     /// We have to pass the name, not the field, since the
     /// field is deleted and re-created inside clear filter.
@@ -846,7 +844,7 @@ tvheadend.epg = function() {
         loadingText: _('Loading...'),
         width: 200,
         displayField: 'val',
-        store: tvheadend.category,
+        store: category,
         mode: 'local',
         editable: true,
         forceSelection: true,
@@ -1177,15 +1175,16 @@ tvheadend.epg = function() {
     });
 
     /* Extra toolbar. Only created if we have categories on the server */
-    tvheadend.createToolbar2 = function() {
-        var tbar2 = new Ext.Toolbar({
-          items: [
-              epgFilterCat1, '-',
-              epgFilterCat2, '-',
-              epgFilterCat3, '-'
-          ]
-        });
-        panel.add(tbar2);
+    var createToolbar2 = function() {
+      var tb2container = Ext.DomHelper.append(panel.tbar, {tag:'div', id:Ext.id()}, true);
+      var tbar2 = new Ext.Toolbar({
+        renderTo: tb2container,
+        items: [
+          epgFilterCat1, '-',
+          epgFilterCat2, '-',
+          epgFilterCat3, '-'
+        ]
+      });
     }
 
     /**