X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=manifold%2Fjs%2Fplugin.js;h=5d3df742cb6d6db2255bfa3392cc6b22469ef270;hb=f7419e1b9bedd90e390fa27bf7d7868db617caee;hp=11aefad5a24a43a4bbb8641cb5676c4d549fa0c3;hpb=a953233a34580bc72aa8b6b03c017ff94f9eee7d;p=unfold.git diff --git a/manifold/js/plugin.js b/manifold/js/plugin.js index 11aefad5..5d3df742 100644 --- a/manifold/js/plugin.js +++ b/manifold/js/plugin.js @@ -83,13 +83,50 @@ var Plugin = Class.extend({ default_options: {}, - speak: function(msg){ - // You have direct access to the associated and cached jQuery element - this.$element.append('

'+msg+'

'); + id: function() + { + var ret = this.options.plugin_uuid; + for (var i = 0; i < arguments.length; i++) { + ret = ret + manifold.separator + arguments[i]; + } + return ret; + }, + + el: function() + { + if (arguments.length == 0) { + return $('#' + this.id()); + } else { + // We make sure to search _inside_ the dom tag of the plugin + return $('#' + this.id.apply(this, arguments), this.el()); + } + }, + + els: function(cls) + { + return $('.' + cls, this.el()); + }, + + id_from_filter: function(filter, use_value) + { + use_value = typeof use_value !== 'undefined' ? use_value : true; + + var key = filter[0]; + var op = filter[1]; + var value = filter[2]; + var op_str = this.getOperatorLabel(op); + var s = manifold.separator; + + if (use_value) { + return 'filter' + s + key + s + op_str + s + value; + } else { + return 'filter' + s + key + s + op_str; + } }, - register: function() { - // Registers the plugin to jQuery + str_from_filter: function(filter) + { + return filter[0] + ' ' + filter[1] + ' ' + filter[2]; }, });