DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: Interfacing FARR with QUIX?  (Read 5,861 times)

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,931
    • Gathering Badge
    • Plugin Coding Medal
    • Participated in NANY Challenge Seventeen Times
    • Cody Award
    • Coding Snacks
    • Volunteers/Staff
Interfacing FARR with QUIX?
« on: February 09, 2010, 08:13 PM »
Lifehacker wrote a story today about Quix, which is a browser bookmarklet that you install in your browser and can then send commandline-like commands to.

http://quixapp.com/

It's reminiscent of http://yubnub.org/ but works inside the client browser rather than over the web.

Anyway, i was wondering if any of the FARR JS gurus can think of a way to maybe let farr send quix commands to the active browser -- might offer a neat way to use it.

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • Plugin Coding Medal
    • Participated in NANY Challenge Three Times
Re: Interfacing FARR with QUIX?
« Reply #1 on: February 10, 2010, 11:31 PM »
For interested parties, below is an expanded version of the bookmarklet:

Code: (javascript)
javascript:Quix();
function Quix() {
  var e = encodeURIComponent;
  var t = window.getSelection ?
            window.getSelection() : 
            (document.getSelection ? 
              document.getSelection() : 
              (document.selection ? 
                document.selection.createRange().text :
                ''));
  var c = window.prompt('Quix: Type `help` for a list of commands:');
  if (t != '') {
    if (c) {
      c += ' ' + t;
    } else {
      c = '' + t;
    }
  }
  if (c) {
    var u = 'http://quixapp.com/go/?c=' + e(c) + 
            '&t=' + 
            (document.title ? 
              e(document.title) : 
              '') +
            '&s=' + '&v=080' + '&u=' + 
            (document.location ? 
              e(document.location) : 
              '');
    d = '' + document.location;
    if (d.substr(0, 4) != 'http') {
      window.location = u + '&mode=direct';
    } else {
      heads = document.getElementsByTagName('head');
      if (c.substring(0, 1) == ' ') {
        var w = window.open(u + '&mode=direct');
        w.focus();
      } else if (heads.length == 0) {
        window.location = u + '&mode=direct';
      } else {
        q = document.getElementById('quix');
        if (q) {
          q.parentNode.removeChild(q);
        }
        sc = document.createElement('script');
        sc.src = u;
        sc.id = 'quix';
        sc.type = 'text/javascript';
        void(heads[0].appendChild(sc));
      }
    }
  }
}
« Last Edit: February 10, 2010, 11:43 PM by ewemoa »

nitrix-ud

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 560
Re: Interfacing FARR with QUIX?
« Reply #2 on: February 11, 2010, 08:50 PM »
that would be pretty cool  :-*

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • Plugin Coding Medal
    • Participated in NANY Challenge Three Times
Re: Interfacing FARR with QUIX?
« Reply #3 on: February 12, 2010, 01:32 AM »
So far, my understanding of Quix is that a fair bit (nearly all?) of the built-in functionality ends up in communication with quixapp.com.  Evidence for this includes:

  • Examination of the quixapp bookmarklet source
  • Wireshark monitoring
  • Testing w/ my network cable unplugged

Lines that look relevant in the source include:

  • window.location = u + '&mode=direct';
  • var w = window.open(u + '&mode=direct');
  • window.location = u + '&mode=direct';
  • void(heads[0].appendChild(sc));

IIUC, each of these is at or near an "exit point" of the code. 

The first three of the four lines mentioned above use "u" directly.  I think "u" starts w/ 'http://quixapp.com/go/?c='; and is only subsequently appended to. 

The fourth of the four lines uses "sc", which incorporates "u" via:

  sc.src = u

If anyone else reads the code differently or thinks I've left out something important, please share :)

Original address: https://www.donationcoder.com/forum/index.php?topic=21682.0