source: OKFNAnnotator (for Zope)/annotator_files/lib/plugin/kitchensink.js @ 4:6979313586cf

Last change on this file since 4:6979313586cf was 4:6979313586cf, checked in by casties, 12 years ago

new version of annotator.

File size: 1.7 KB
Line 
1// Generated by CoffeeScript 1.3.3
2var __hasProp = {}.hasOwnProperty,
3  __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
4
5Annotator.prototype.setupPlugins = function(config, options) {
6  var name, opts, pluginConfig, plugins, uri, win, _i, _len, _results;
7  if (config == null) {
8    config = {};
9  }
10  if (options == null) {
11    options = {};
12  }
13  win = util.getGlobal();
14  plugins = ['Unsupported', 'Auth', 'Tags', 'Filter', 'Store', 'AnnotateItPermissions'];
15  if (win.Showdown) {
16    plugins.push('Markdown');
17  }
18  uri = win.location.href.split(/#|\?/).shift() || '';
19  pluginConfig = {
20    Tags: {},
21    Filter: {
22      filters: [
23        {
24          label: Annotator._t('User'),
25          property: 'user'
26        }, {
27          label: Annotator._t('Tags'),
28          property: 'tags'
29        }
30      ]
31    },
32    Auth: {
33      tokenUrl: config.tokenUrl || 'http://annotateit.org/api/token'
34    },
35    Store: {
36      prefix: config.storeUrl || 'http://annotateit.org/api',
37      annotationData: {
38        uri: uri
39      },
40      loadFromSearch: {
41        uri: uri
42      }
43    }
44  };
45  for (name in options) {
46    if (!__hasProp.call(options, name)) continue;
47    opts = options[name];
48    if (__indexOf.call(plugins, name) < 0) {
49      plugins.push(name);
50    }
51  }
52  $.extend(true, pluginConfig, options);
53  _results = [];
54  for (_i = 0, _len = plugins.length; _i < _len; _i++) {
55    name = plugins[_i];
56    if (!(name in pluginConfig) || pluginConfig[name]) {
57      _results.push(this.addPlugin(name, pluginConfig[name]));
58    } else {
59      _results.push(void 0);
60    }
61  }
62  return _results;
63};
Note: See TracBrowser for help on using the repository browser.