Mercurial > hg > OKFNAnnotator
comparison annotator_files/lib/plugin/kitchensink.js @ 4:6979313586cf
new version of annotator.
| author | casties |
|---|---|
| date | Mon, 27 Aug 2012 19:05:38 +0200 |
| parents | 6356e78ccf5c |
| children |
comparison
equal
deleted
inserted
replaced
| 3:6356e78ccf5c | 4:6979313586cf |
|---|---|
| 1 var __hasProp = Object.prototype.hasOwnProperty, | 1 // Generated by CoffeeScript 1.3.3 |
| 2 __indexOf = Array.prototype.indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; | 2 var __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; }; | |
| 3 | 4 |
| 4 Annotator.prototype.setupPlugins = function(config, options) { | 5 Annotator.prototype.setupPlugins = function(config, options) { |
| 5 var name, opts, pluginConfig, plugins, uri, win, _i, _len, _results; | 6 var name, opts, pluginConfig, plugins, uri, win, _i, _len, _results; |
| 6 if (config == null) config = {}; | 7 if (config == null) { |
| 7 if (options == null) options = {}; | 8 config = {}; |
| 9 } | |
| 10 if (options == null) { | |
| 11 options = {}; | |
| 12 } | |
| 8 win = util.getGlobal(); | 13 win = util.getGlobal(); |
| 9 plugins = ['Unsupported', 'Auth', 'Tags', 'Filter', 'Store', 'Permissions']; | 14 plugins = ['Unsupported', 'Auth', 'Tags', 'Filter', 'Store', 'AnnotateItPermissions']; |
| 10 if (win.Showdown) plugins.push('Markdown'); | 15 if (win.Showdown) { |
| 16 plugins.push('Markdown'); | |
| 17 } | |
| 11 uri = win.location.href.split(/#|\?/).shift() || ''; | 18 uri = win.location.href.split(/#|\?/).shift() || ''; |
| 12 pluginConfig = { | 19 pluginConfig = { |
| 13 Tags: {}, | 20 Tags: {}, |
| 14 Filter: { | 21 Filter: { |
| 15 filters: [ | 22 filters: [ |
| 36 } | 43 } |
| 37 }; | 44 }; |
| 38 for (name in options) { | 45 for (name in options) { |
| 39 if (!__hasProp.call(options, name)) continue; | 46 if (!__hasProp.call(options, name)) continue; |
| 40 opts = options[name]; | 47 opts = options[name]; |
| 41 if (__indexOf.call(plugins, name) < 0) plugins.push(name); | 48 if (__indexOf.call(plugins, name) < 0) { |
| 49 plugins.push(name); | |
| 50 } | |
| 42 } | 51 } |
| 43 $.extend(true, pluginConfig, options); | 52 $.extend(true, pluginConfig, options); |
| 44 _results = []; | 53 _results = []; |
| 45 for (_i = 0, _len = plugins.length; _i < _len; _i++) { | 54 for (_i = 0, _len = plugins.length; _i < _len; _i++) { |
| 46 name = plugins[_i]; | 55 name = plugins[_i]; |
