|
|
@@ -20,49 +20,53 @@
|
|
|
;
|
|
|
(function ($, window, document, undefined) {
|
|
|
|
|
|
- var pluginName = "jHueRowSelector",
|
|
|
- defaults = {
|
|
|
- };
|
|
|
+ var pluginName = "jHueRowSelector",
|
|
|
+ defaults = {};
|
|
|
|
|
|
- function Plugin(element, options) {
|
|
|
- this.element = element;
|
|
|
- this.options = $.extend({}, defaults, options);
|
|
|
- this._defaults = defaults;
|
|
|
- this._name = pluginName;
|
|
|
- this.init();
|
|
|
- }
|
|
|
+ function Plugin(element, options) {
|
|
|
+ this.element = element;
|
|
|
+ this.options = $.extend({}, defaults, options);
|
|
|
+ this._defaults = defaults;
|
|
|
+ this._name = pluginName;
|
|
|
+ this.init();
|
|
|
+ }
|
|
|
|
|
|
- Plugin.prototype.setOptions = function (options) {
|
|
|
- this.options = $.extend({}, defaults, options);
|
|
|
- };
|
|
|
+ Plugin.prototype.setOptions = function (options) {
|
|
|
+ this.options = $.extend({}, defaults, options);
|
|
|
+ };
|
|
|
|
|
|
- Plugin.prototype.init = function () {
|
|
|
- var _this = this;
|
|
|
- $(_this.element).closest("tr").click(function (e) {
|
|
|
- if ($(e.target).data("row-selector-exclude") || $(e.target).closest("td").hasClass("row-selector-exclude")) {
|
|
|
- return;
|
|
|
- }
|
|
|
- if (!$(e.target).is("a")) {
|
|
|
- var href = $.trim($(_this.element).attr("href"));
|
|
|
- if (href != "" && href != "#" && href.indexOf("void(0)") == -1) {
|
|
|
- location.href = $(_this.element).attr("href");
|
|
|
- }
|
|
|
- else {
|
|
|
- $(_this.element).click();
|
|
|
- }
|
|
|
- }
|
|
|
- }).css("cursor", "pointer");
|
|
|
- };
|
|
|
+ Plugin.prototype.init = function () {
|
|
|
+ var _this = this;
|
|
|
+ $(_this.element).closest("tr").click(function (e) {
|
|
|
+ if ($(e.target).data("row-selector-exclude") || $(e.target).closest("td").hasClass("row-selector-exclude")) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (!$(e.target).is("a")) {
|
|
|
+ var href = $.trim($(_this.element).attr("href"));
|
|
|
+ if (href != "" && href != "#" && href.indexOf("void(0)") == -1) {
|
|
|
+ if (IS_HUE_4) {
|
|
|
+ huePubSub.publish('open.link', $(_this.element).attr("href"));
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ location.href = $(_this.element).attr("href");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $(_this.element).click();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }).css("cursor", "pointer");
|
|
|
+ };
|
|
|
|
|
|
- $.fn[pluginName] = function (options) {
|
|
|
- return this.each(function () {
|
|
|
- if (!$.data(this, 'plugin_' + pluginName)) {
|
|
|
- $.data(this, 'plugin_' + pluginName, new Plugin(this, options));
|
|
|
- }
|
|
|
- else {
|
|
|
- $.data(this, 'plugin_' + pluginName).setOptions(options);
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
+ $.fn[pluginName] = function (options) {
|
|
|
+ return this.each(function () {
|
|
|
+ if (!$.data(this, 'plugin_' + pluginName)) {
|
|
|
+ $.data(this, 'plugin_' + pluginName, new Plugin(this, options));
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $.data(this, 'plugin_' + pluginName).setOptions(options);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
})(jQuery, window, document);
|