Sha256: 6fc59f917df14dfb1ce7317b7ca0aeca8ca611ea6890c0ca58e29fb14103667b

Contents?: true

Size: 1.88 KB

Versions: 20

Compression:

Stored size: 1.88 KB

Contents

var Localization = {
  // TODO Remove.
  location_delimiters: { de:'in', fr:'à', it:'a', en:'in', ch:'in' },
  
  explanation_delimiters: { de:'und', fr:'et', it:'e', en:'and', ch:'und' }
};

// The client handles parameters and
// offers an insert method.
//
var PickyClient = function(config) {
  
  // Params handling.
  //
  
  // This is used to generate the correct query strings, localized.
  //
  // e.g with locale it:
  // ['title', 'ulysses', 'Ulysses'] => 'titolo:ulysses'
  //
  // This needs to correspond to the parsing in the search engine.
  //
  Localization.qualifiers   = config.qualifiers || {};
  
  // This is used to explain the preceding word in the suggestion text.
  //
  // e.g. with locale it:
  // ['title', 'ulysses', 'Ulysses'] => 'Ulysses (titolo)'
  //
  Localization.explanations = config.explanations || {};
  
  // TODO Explain.
  //
  Localization.explanation_delimiters = { de:'und', fr:'et', it:'e', en:'and', ch:'und' };
  
  // Either you pass it a backends hash with full and live,
  // or you pass it full and live (urls), which will then
  // be wrapped in appropriate backends. 
  //
  var backends = config.backends;
  if (backends) {
    backends.live || alert('Both a full and live backend must be provided.');
    backends.full || alert('Both a full and live backend must be provided.');
  } else {
    config.backends = {
      live: config.live && new LiveBackend(config.live) || alert('A live backend path must be provided.'),
      full: config.full && new FullBackend(config.full) || alert('A live backend path must be provided.')
    };
  }
  
  // The central Picky controller.
  //
  var controller = config.controller && new config.controller(config) || new PickyController(config);
  
  // Insert a query into the client and run it.
  // Default is a full query.
  //
  this.insert = function(query, full) {
    controller.insert(query, full || true);
  };
  
};

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
picky-client-1.1.0 sinatra_prototype/javascripts/picky.client.js
picky-client-1.0.0 sinatra_prototype/javascripts/picky.client.js
picky-client-0.12.3 sinatra_prototype/javascripts/picky.client.js
picky-client-0.12.2 sinatra_prototype/javascripts/picky.client.js
picky-client-0.12.1 sinatra_prototype/javascripts/picky.client.js
picky-client-0.12.0 sinatra_prototype/javascripts/picky.client.js
picky-client-0.11.2 sinatra_prototype/javascripts/picky.client.js
picky-client-0.11.1 sinatra_prototype/javascripts/picky.client.js
picky-client-0.11.0 sinatra_prototype/javascripts/picky.client.js
picky-client-0.10.5 sinatra_prototype/javascripts/picky.client.js
picky-client-0.10.4 sinatra_prototype/javascripts/picky.client.js
picky-client-0.10.2 sinatra_prototype/javascripts/picky.client.js
picky-client-0.10.1 sinatra_prototype/javascripts/picky.client.js
picky-client-0.10.0 sinatra_prototype/javascripts/picky.client.js
picky-client-0.9.4 sinatra_prototype/javascripts/picky.client.js
picky-client-0.9.3 sinatra_prototype/javascripts/picky.client.js
picky-client-0.9.2 sinatra_prototype/javascripts/picky.client.js
picky-client-0.9.1 sinatra_prototype/javascripts/picky.client.js
picky-client-0.9.0 sinatra_prototype/javascripts/picky.client.js
picky-client-0.3.0 sinatra_prototype/javascripts/picky.client.js