Friday, May 15, 2015

Adding !page commands to Gleebox

To go with yesterday's post, I also wanted the ability to open TT-RSS in a new window.  Doing so is straight-forward:

1) Edit glee.js and add the following (somewhere near the entry for 'rss'):
  {
     name: 'ttrss',
     method: 'openttrss',
     description: 'Open TT-RSS in a new page',
     statusText: 'Opening TT-RSS...'
  },
2) Edit pagecmds.js and add the following (somewhere near Glee.getRSSLink):
Glee.openttrss = function(newtab) {
   Glee.Browser.openURL('http://192.168.2.240/tt-rss',1,true);
   Glee.empty();
};
3) Restart your browser and test

Just in case you want to add other commands, Glee.Browser.openURL requires three arguments, in the following order:
Arg 1 = whichever URL you want to call, doesn't have to be http: or https:
Arg 2 = open a new tab? (0 or false = no, 1 or true = yes, "newtab" = dependent on input (enter = 0, shift-enter = 1))
Arg3 = selected? - if a new tab is opened, should focus be placed on it?  (1/true or 0/false)

No comments:

Post a Comment