extended-spine
Advanced tools
Comparing version 1.0.4 to 1.1.0
// Generated by CoffeeScript 1.6.3 | ||
(function() { | ||
var $, Controller, Spine, isMobile, | ||
var $, Controller, Spine, hasAttr, isMobile, num, | ||
__hasProp = {}.hasOwnProperty, | ||
@@ -13,5 +13,15 @@ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | ||
num = 0; | ||
hasAttr = function(el, name) { | ||
var attr; | ||
attr = $(el).attr(name); | ||
return typeof attr !== 'undefined' && attr !== false; | ||
}; | ||
Controller = (function(_super) { | ||
__extends(Controller, _super); | ||
Controller.prototype.id = null; | ||
function Controller(el) { | ||
@@ -25,2 +35,3 @@ if (el == null) { | ||
Controller.__super__.constructor.call(this, this, []); | ||
this.id = this.el.attr('id'); | ||
this.el.data('controller', this); | ||
@@ -34,7 +45,2 @@ } | ||
$ = jQuery; | ||
$.fn.hasAttr = function(name) { | ||
var attr; | ||
attr = $(this).attr(name); | ||
return typeof attr !== 'undefined' && attr !== false; | ||
}; | ||
$.fn.getController = function() { | ||
@@ -96,3 +102,3 @@ return $(this).data('controller'); | ||
result = []; | ||
if (scope.hasAttr('data-controller')) { | ||
if (hasAttr(scope, 'data-controller')) { | ||
result.push(scope); | ||
@@ -147,4 +153,4 @@ } | ||
} | ||
computer = el.hasAttr('data-computer'); | ||
mobile = el.hasAttr('data-mobile'); | ||
computer = hasAttr(el, 'data-computer'); | ||
mobile = hasAttr(el, 'data-mobile'); | ||
if (el !== null && (computer || mobile)) { | ||
@@ -158,2 +164,6 @@ if (computer && isMobile()) { | ||
} | ||
if (el !== null && el.length > 0 && !hasAttr(el, 'id')) { | ||
el.attr('id', '_controller' + num); | ||
num++; | ||
} | ||
return this.createController(path, el); | ||
@@ -160,0 +170,0 @@ }; |
{ | ||
"name": "extended-spine", | ||
"description": "Some extensions for spine framework", | ||
"version": "1.0.4", | ||
"version": "1.1.0", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "David Kudera", |
@@ -96,2 +96,6 @@ # extended-spine | ||
* 1.1.0 | ||
+ Automatically creates html id | ||
+ Some optimization | ||
* 1.0.4 | ||
@@ -98,0 +102,0 @@ + Wrong variable names |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
173609
2226
111