Permalink
Browse files

Modified: copyright

  • Loading branch information...
1 parent 980136f commit 630fe1fc089e74ae11c87c398fb6bb870e4e7708 @bu committed Mar 23, 2013
Showing with 5 additions and 9 deletions.
  1. +2 −8 js/jquery.hcolumns.js
  2. +3 −1 js/jquery.hcolumns.min.js
View
10 js/jquery.hcolumns.js 100644 → 100755
@@ -1,12 +1,6 @@
-// hColumns
-// ===============
-(function($) {
- //
- // Default values
- // -----------------
+// hColumns by bu <bu@hax4.in>, BSD License
- // Default Config
- //
+(function($) {
var defaultConfig = {
nodeSource: function() {
return window.alert("dummy source, you need to create a node source");
View
4 js/jquery.hcolumns.min.js 100644 → 100755
@@ -1 +1,3 @@
-(function($){var defaultConfig={nodeSource:function(){return window.alert("dummy source, you need to create a node source")},noContentString:"There is no node here",labelText_maxLength:15,customNodeTypeIndicator:{},customNodeTypeHandler:{}};var defaultHandler={folder:function(hColumn,node,data){hColumn.nodeSource(data.id,function(err,data){if(err){return $.error(err)}return hColumn.columnView._addColumnList(data,hColumn.columnView)})},link:function(hColumn,node,data){return window.open(data.url)}};var defaultIndicator={folder:"icon-chevron-right",link:"icon-globe"};var methods={init:function(options){var settings=$.extend(defaultConfig,options);var handlers=$.extend(defaultHandler,settings.customNodeTypeHandler);var indicators=$.extend(defaultIndicator,settings.customNodeTypeIndicator);return this.each(function(){var self=$(this),data=self.data("columnView");methods.settings=settings;settings.columnView=methods;settings.handlers=handlers;settings.indicators=indicators;settings.container_node=this;if(!data){self.data("hColumn",settings);self.addClass("column-view-container");$("<div></div>").addClass("column-view-composition").appendTo(self);self.on("click",".column ul li",settings.columnView._entryClick);settings.nodeSource(null,function(err,data){if(err){return $.error(err)}return settings.columnView._addColumnList(data)})}})},_entryClick:function(){var columnView=$(this).parents(".column-view-container").data("hColumn");var current_container=$(this).parents(".column-view-container");var current_click_column=$(this).parents(".column");var current_click_level=$(this).parents(".column").index();var current_node_type=$(this).data("node-type");var current_node_data=$(this).data("node-data");$(current_container).find(".column-view-composition .column:gt("+current_click_level+")").remove();current_click_column.find(".active").removeClass("active");$(this).addClass("active");return columnView.handlers[current_node_type](columnView,this,current_node_data)},_addColumnList:function(list,columnView){var self=!columnView?this:columnView;var ListElm=$("<ul></ul>");if(list.length===0){var NoContentElm=$("<p></p>").text(columnView.settings.noContentString);return self._addColumn(NoContentElm,self)}list.map(function(entry){var EntryElm=$("<li></li>").data("node-id",entry.id).data("node-type",entry.type).data("node-data",entry);var EntryIconElm=$("<i></i>").addClass(self.settings.indicators[entry.type]);if(entry.label.length>self.settings.labelText_maxLength){entry.label=entry.label.substring(0,self.settings.labelText_maxLength-3)+"..."}EntryElm.append(document.createTextNode(entry.label));EntryElm.append(EntryIconElm);EntryElm.appendTo(ListElm)});return self._addColumn(ListElm,self)},_addColumn:function(content_dom_node,columnView){var ColumnElm=$("<div></div>").addClass("column");ColumnElm.append(content_dom_node);$(columnView.settings.container_node).find(".column-view-composition").append(ColumnElm);$(columnView.settings.container_node).scrollLeft($(".column-view-composition").width())}};$.fn.hColumns=function(method){if(methods[method]){return methods[method].apply(this,Array.prototype.slice.call(arguments,1))}else if(typeof method==="object"||!method){return methods.init.apply(this,arguments)}else{$.error("Method "+method+" does not exist on jQuery.hColumns")}}})(jQuery);
+// hColumns by bu <bu@hax4.in>, BSD License
+
+(function($){var defaultConfig={nodeSource:function(){return window.alert("dummy source, you need to create a node source")},noContentString:"There is no node here",labelText_maxLength:15,customNodeTypeIndicator:{},customNodeTypeHandler:{}};var defaultHandler={folder:function(hColumn,node,data){hColumn.nodeSource(data.id,function(err,data){if(err){return $.error(err)}return hColumn.columnView._addColumnList(data,hColumn.columnView)})},link:function(hColumn,node,data){return window.open(data.url)}};var defaultIndicator={folder:"icon-chevron-right",link:"icon-globe"};var methods={init:function(options){var settings=$.extend(defaultConfig,options);var handlers=$.extend(defaultHandler,settings.customNodeTypeHandler);var indicators=$.extend(defaultIndicator,settings.customNodeTypeIndicator);return this.each(function(){var self=$(this),data=self.data("columnView");methods.settings=settings;settings.columnView=methods;settings.handlers=handlers;settings.indicators=indicators;settings.container_node=this;if(!data){self.data("hColumn",settings);self.addClass("column-view-container");$("<div></div>").addClass("column-view-composition").appendTo(self);self.on("click",".column ul li",settings.columnView._entryClick);settings.nodeSource(null,function(err,data){if(err){return $.error(err)}return settings.columnView._addColumnList(data)})}})},_entryClick:function(){var columnView=$(this).parents(".column-view-container").data("hColumn");var current_container=$(this).parents(".column-view-container");var current_click_column=$(this).parents(".column");var current_click_level=$(this).parents(".column").index();var current_node_type=$(this).data("node-type");var current_node_data=$(this).data("node-data");$(current_container).find(".column-view-composition .column:gt("+current_click_level+")").remove();current_click_column.find(".active").removeClass("active");$(this).addClass("active");return columnView.handlers[current_node_type](columnView,this,current_node_data)},_addColumnList:function(list,columnView){var self=!columnView?this:columnView;var ListElm=$("<ul></ul>");if(list.length===0){var NoContentElm=$("<p></p>").text(columnView.settings.noContentString);return self._addColumn(NoContentElm,self)}list.map(function(entry){var EntryElm=$("<li></li>").data("node-id",entry.id).data("node-type",entry.type).data("node-data",entry);var EntryIconElm=$("<i></i>").addClass(self.settings.indicators[entry.type]);if(entry.label.length>self.settings.labelText_maxLength){entry.label=entry.label.substring(0,self.settings.labelText_maxLength-3)+"..."}EntryElm.append(document.createTextNode(entry.label));EntryElm.append(EntryIconElm);EntryElm.appendTo(ListElm)});return self._addColumn(ListElm,self)},_addColumn:function(content_dom_node,columnView){var ColumnElm=$("<div></div>").addClass("column");ColumnElm.append(content_dom_node);$(columnView.settings.container_node).find(".column-view-composition").append(ColumnElm);$(columnView.settings.container_node).scrollLeft($(".column-view-composition").width())}};$.fn.hColumns=function(method){if(methods[method]){return methods[method].apply(this,Array.prototype.slice.call(arguments,1))}else if(typeof method==="object"||!method){return methods.init.apply(this,arguments)}else{$.error("Method "+method+" does not exist on jQuery.hColumns")}}})(jQuery);

0 comments on commit 630fe1f

Please sign in to comment.