topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday March 28, 2024, 2:11 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Interfacing FARR with QUIX?  (Read 4473 times)

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,896
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Interfacing FARR with QUIX?
« on: February 09, 2010, 02: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
    • View Profile
    • Donate to Member
Re: Interfacing FARR with QUIX?
« Reply #1 on: February 10, 2010, 05:31 PM »
For interested parties, below is an expanded version of the bookmarklet:

Code: Javascript [Select]
  1. javascript:Quix();
  2. function Quix() {
  3.   var e = encodeURIComponent;
  4.   var t = window.getSelection ?
  5.             window.getSelection() :
  6.             (document.getSelection ?
  7.               document.getSelection() :
  8.               (document.selection ?
  9.                 document.selection.createRange().text :
  10.                 ''));
  11.   var c = window.prompt('Quix: Type `help` for a list of commands:');
  12.   if (t != '') {
  13.     if (c) {
  14.       c += ' ' + t;
  15.     } else {
  16.       c = '' + t;
  17.     }
  18.   }
  19.   if (c) {
  20.     var u = 'http://quixapp.com/go/?c=' + e(c) +
  21.             '&t=' +
  22.             (document.title ?
  23.               e(document.title) :
  24.               '') +
  25.             '&s=' + '&v=080' + '&u=' +
  26.             (document.location ?
  27.               e(document.location) :
  28.               '');
  29.     d = '' + document.location;
  30.     if (d.substr(0, 4) != 'http') {
  31.       window.location = u + '&mode=direct';
  32.     } else {
  33.       heads = document.getElementsByTagName('head');
  34.       if (c.substring(0, 1) == ' ') {
  35.         var w = window.open(u + '&mode=direct');
  36.         w.focus();
  37.       } else if (heads.length == 0) {
  38.         window.location = u + '&mode=direct';
  39.       } else {
  40.         q = document.getElementById('quix');
  41.         if (q) {
  42.           q.parentNode.removeChild(q);
  43.         }
  44.         sc = document.createElement('script');
  45.         sc.src = u;
  46.         sc.id = 'quix';
  47.         sc.type = 'text/javascript';
  48.         void(heads[0].appendChild(sc));
  49.       }
  50.     }
  51.   }
  52. }
« Last Edit: February 10, 2010, 05:43 PM by ewemoa »

nitrix-ud

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

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: Interfacing FARR with QUIX?
« Reply #3 on: February 11, 2010, 07:32 PM »
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 :)