Permalink
Browse files

Moved last.fm content script, added tests

  • Loading branch information...
1 parent d1475e4 commit 93593c74aeed11350f6da47bab51427e04f0fa52 @buger committed Aug 25, 2012

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -1434,3 +1434,5 @@ window.Zepto = Zepto;
$.fn[m] = function(callback){ return this.bind(m, callback) }
});
})(Zepto);
+
+jQuery = Zepto
@@ -0,0 +1,17 @@
+_.extend @chromus.utils,
+ urlType: (url) ->
+ params = _.rest url.replace(/https?\:\/\//,'').split('/')
+
+ switch params[0]
+ when "music"
+ if params.length is 2
+ "band"
+ else if params[2] is '_'
+ "song"
+ else if params[2][0] is '+'
+ "music"
+ else if params.length is 3
+ "album"
+
+ else params[0]
+
@@ -1,2 +1,25 @@
+(function() {
+ _.extend(this.chromus.utils, {
+ urlType: function(url) {
+ var params;
+ params = _.rest(url.replace(/https?\:\/\//, '').split('/'));
+ switch (params[0]) {
+ case "music":
+ if (params.length === 2) {
+ return "band";
+ } else if (params[2] === '_') {
+ return "song";
+ } else if (params[2][0] === '+') {
+ return "music";
+ } else if (params.length === 3) {
+ return "album";
+ }
+ break;
+ default:
+ return params[0];
+ }
+ }
+ });
+}).call(this);
@@ -13,6 +13,11 @@
"popup!lastfm_ui.js",
"css!lastfm.css",
- "bg_spec!lastfm_spec.js"
+ "bg_spec!spec/lastfm_spec.js",
+
+ "test_mode!content_script.js",
+
+ "popup_spec!site_integration.js",
+ "popup_spec!spec/content_script_spec.js"
]
}
Oops, something went wrong.

0 comments on commit 93593c7

Please sign in to comment.