// Licensed to Cloudera, Inc. under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. Cloudera, Inc. licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use this file except in compliance // with the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. /* * jHue table extender plugin * */ ; (function ($, window, document, undefined) { var pluginName = "jHueTableExtender", defaults = { fixedHeader:false, firstColumnTooltip:false, hintElement:null, includeNavigator: true, labels:{ GO_TO_COLUMN:"Go to column:", PLACEHOLDER:"column name..." } }; function Plugin(element, options) { this.element = element; if (typeof jHueTableExtenderGlobals != 'undefined') { var extendedDefaults = $.extend({}, defaults, jHueFileChooserGlobals); extendedDefaults.labels = $.extend({}, defaults.labels, jHueFileChooserGlobals.labels); this.options = $.extend({}, extendedDefaults, options); if (options != null) { this.options.labels = $.extend({}, extendedDefaults.labels, options.labels); } } else { this.options = $.extend({}, defaults, options); if (options != null) { this.options.labels = $.extend({}, defaults.labels, options.labels); } } this._defaults = defaults; this._name = pluginName; this.previousPath = ""; this.init(); } Plugin.prototype.setOptions = function (options) { this.options = $.extend({}, defaults, options); drawHeader(this); }; Plugin.prototype.resetSource = function() { var _this = this; if (_this.options.includeNavigator){ var source = []; $(this.element).find("th").each(function () { source.push($(this).text()); }); $("#jHueTableExtenderNavigator").find("input").data('typeahead').source = source; } }; Plugin.prototype.init = function () { $.expr[":"].econtains = function (obj, index, meta, stack) { return (obj.textContent || obj.innerText || $(obj).text() || "").toLowerCase() == meta[3].toLowerCase(); } var _this = this; if (_this.options.includeNavigator){ var jHueTableExtenderNavigator = $("
").attr("id", "jHueTableExtenderNavigator"); $("").attr("href", "#").addClass("pull-right").html("×").click(function (e) { e.preventDefault(); $(this).parent().hide(); }).appendTo(jHueTableExtenderNavigator); $("