Permalink
Browse files

Update to have correct interpolation syntax

  • Loading branch information...
1 parent 4477359 commit dbe35ab2591c9e410d3641e03df9c20c9b0a9f3e @Sutto committed Aug 21, 2010
@@ -3,11 +3,11 @@
# First off, add our dataAttr extensions.
if jQuery?
(($) ->
- stringToDataKey = (key) -> "data-$key".replace /_/g, '-'
- $.fn.dataAttr = (key, value) -> @attr stringToDataKey(key), value
- $.fn.removeDataAttr = (key) -> @removeAttr stringToDataKey(key)
- $.fn.hasDataAttr = (key) -> @is "[${stringToDataKey(key)}]"
- $.metaAttr = (key) -> $("meta[name='$key']").attr "content"
+ stringToDataKey = (key) -> "data-#{key}".replace /_/g, '-'
+ $.fn.dataAttr = (key, value) -> @attr stringToDataKey(key), value
+ $.fn.removeDataAttr = (key) -> @removeAttr stringToDataKey(key)
+ $.fn.hasDataAttr = (key) -> @is "[#{stringToDataKey(key)}]"
+ $.metaAttr = (key) -> $("meta[name='#{key}']").attr "content"
)(jQuery)
@@ -77,10 +77,10 @@
not @parent?
base.log = (args...) ->
- console.log "[${@toNSName()}]", args...
+ console.log "[#{@toNSName()}]", args...
base.debug = (args...) ->
- console.log "[Debug - ${@toNSName()}]", args...
+ console.log "[Debug: #{@toNSName()}]", args...
base.setupVia = (f) ->
$(document).ready => scopedClosure(f, @) if @autosetup?
@@ -90,9 +90,9 @@
if ns?
scopedClosure callback, ns
else
- path = Shuriken.Util.underscoreize "${@toNSName()}.$key"
- url = "${Shuriken.jsPathPrefix}${path}.js${Shuriken.jsPathSuffix}"
- script = $ "<script />", {type: "text/javascript", src: url}
+ path = Shuriken.Util.underscoreize "#{@toNSName()}.#{key}"
+ url = "#{Shuriken.jsPathPrefix}#{path}.js#{Shuriken.jsPathSuffix}"
+ script = $ "<script />", type: "text/javascript", src: url
script.load -> scopedClosure callback, @getNS(key)
script.appendTo $ "head"
@@ -4,8 +4,8 @@ Shuriken.defineExtension (baseNS) ->
mixin.callbacks = {}
mixin.defineCallback = (key) ->
- @["on$key"] = (callback) -> @hasCallback key, callback
- @["invoke$key"] = (args...) -> @invokeCallbacks key, args...
+ @["on#{key}"] = (callback) -> @hasCallback key, callback
+ @["invoke#{key}"] = (args...) -> @invokeCallbacks key, args...
true
mixin.hasCallback = (name, callback) ->
View
@@ -7,7 +7,7 @@ var __slice = Array.prototype.slice, __bind = function(func, context) {
(function($) {
var stringToDataKey;
stringToDataKey = function(key) {
- return "data-$key".replace(/_/g, '-');
+ return ("data-" + (key)).replace(/_/g, '-');
};
$.fn.dataAttr = function(key, value) {
return this.attr(stringToDataKey(key), value);
@@ -16,10 +16,10 @@ var __slice = Array.prototype.slice, __bind = function(func, context) {
return this.removeAttr(stringToDataKey(key));
};
$.fn.hasDataAttr = function(key) {
- return this.is("[${stringToDataKey(key)}]");
+ return this.is(("[" + (stringToDataKey(key)) + "]"));
};
return ($.metaAttr = function(key) {
- return $("meta[name='$key']").attr("content");
+ return $(("meta[name='" + (key) + "']")).attr("content");
});
})(jQuery);
};
@@ -112,12 +112,12 @@ var __slice = Array.prototype.slice, __bind = function(func, context) {
base.log = function() {
var args;
args = __slice.call(arguments, 0);
- return console.log.apply(console, ["[${@toNSName()}]"].concat(args));
+ return console.log.apply(console, [("[" + (this.toNSName()) + "]")].concat(args));
};
base.debug = function() {
var args;
args = __slice.call(arguments, 0);
- return console.log.apply(console, ["[Debug - ${@toNSName()}]"].concat(args));
+ return console.log.apply(console, [("[Debug: " + (this.toNSName()) + "]")].concat(args));
};
base.setupVia = function(f) {
return $(document).ready(__bind(function() {
@@ -133,8 +133,8 @@ var __slice = Array.prototype.slice, __bind = function(func, context) {
if ((typeof ns !== "undefined" && ns !== null)) {
return scopedClosure(callback, ns);
} else {
- path = Shuriken.Util.underscoreize("${@toNSName()}.$key");
- url = "${Shuriken.jsPathPrefix}${path}.js${Shuriken.jsPathSuffix}";
+ path = Shuriken.Util.underscoreize(("" + (this.toNSName()) + "." + (key)));
+ url = ("" + (Shuriken.jsPathPrefix) + (path) + ".js" + (Shuriken.jsPathSuffix));
script = $("<script />", {
type: "text/javascript",
src: url
@@ -3,10 +3,10 @@ Shuriken.defineExtension(function(baseNS) {
return baseNS.defineMixin('Callbacks', function(mixin) {
mixin.callbacks = {};
mixin.defineCallback = function(key) {
- this["on$key"] = function(callback) {
+ this[("on" + (key))] = function(callback) {
return this.hasCallback(key, callback);
};
- this["invoke$key"] = function() {
+ this[("invoke" + (key))] = function() {
var args;
args = __slice.call(arguments, 0);
return this.invokeCallbacks.apply(this, [key].concat(args));

0 comments on commit dbe35ab

Please sign in to comment.