From 92f93fe325dde7ed08ffddac618d82416704a1f9 Mon Sep 17 00:00:00 2001 From: Josh Sherman Date: Wed, 17 Sep 2014 13:23:35 -0400 Subject: [PATCH] That spaces life. Linked file from README --- README.md | 7 +-- example.html | 54 ++++++++++----------- jquery.soundcloud.js | 112 +++++++++++++++++++++---------------------- 3 files changed, 87 insertions(+), 86 deletions(-) diff --git a/README.md b/README.md index 46a2098..6c5fe3d 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ -jquery.soundcloud -================= +# jquery.soundcloud jQuery plugin to inject the SoundCloud player. -Check `example.html` for more information. +Check [example.html][example] for more information. + +[example]: https://github.com/joshtronic/jquery.soundcloud/blob/master/example.html diff --git a/example.html b/example.html index ec3e4ab..8a13a69 100644 --- a/example.html +++ b/example.html @@ -1,32 +1,32 @@ - - jQuery SoundCloud Plugin - - - - - -

jQuery SoundCloud Plugin

+ + jQuery SoundCloud Plugin + + + + + +

jQuery SoundCloud Plugin

-

Maximum Config

-
+

Maximum Config

+
-

Minimal Config

-
- +

Minimal Config

+
+ diff --git a/jquery.soundcloud.js b/jquery.soundcloud.js index 9c084d8..6f3e89a 100644 --- a/jquery.soundcloud.js +++ b/jquery.soundcloud.js @@ -1,66 +1,66 @@ (function($) { - $.fn.soundcloud = function(options) - { - // Default settings - var defaults = { - auto_play: false, - //callback: false, - client_id: false, - color: false, - iframe: true, - maxheight: false, - maxwidth: false, - show_comments: true, - url: false - }; + $.fn.soundcloud = function(options) + { + // Default settings + var defaults = { + auto_play: false, + //callback: false, + client_id: false, + color: false, + iframe: true, + maxheight: false, + maxwidth: false, + show_comments: true, + url: false + }; - // Overrides the defaults with passed in options - options = $.extend({}, defaults, options); + // Overrides the defaults with passed in options + options = $.extend({}, defaults, options); - var elements = this; - var protocol = document.location.protocol == 'https:' ? 'https://' : 'http://'; + var elements = this; + var protocol = document.location.protocol == 'https:' ? 'https://' : 'http://'; - if (typeof SC === 'undefined') - { - $.getScript( - protocol + 'connect.soundcloud.com/sdk.js', - function() - { - elements.each(function(index, element) - { - try - { - // Overrides the options with the data attributes - parameters = $.extend({}, options, $(this).data()); + if (typeof SC === 'undefined') + { + $.getScript( + protocol + 'connect.soundcloud.com/sdk.js', + function() + { + elements.each(function(index, element) + { + try + { + // Overrides the options with the data attributes + parameters = $.extend({}, options, $(this).data()); - // Checks that we have a client ID - if (!parameters.client_id) - { - throw 'Missing client ID.'; - } + // Checks that we have a client ID + if (!parameters.client_id) + { + throw 'Missing client ID.'; + } - SC.initialize({ client_id: parameters.client_id }); + SC.initialize({ client_id: parameters.client_id }); - // Request the embed HTML - SC.oEmbed( - parameters.url, - parameters, - function(oEmbed) - { - $(element).replaceWith(oEmbed.html.replace("https://", protocol)); - } - ); - } - catch (error) - { - console.log('[jQuery.SoundCloud] [error] ' + error); - } - }); - } - ); - } + // Request the embed HTML + SC.oEmbed( + parameters.url, + parameters, + function(oEmbed) + { + $(element).replaceWith(oEmbed.html.replace("https://", protocol)); + } + ); + } + catch (error) + { + console.log('[jQuery.SoundCloud] [error] ' + error); + } + }); + } + ); + } - return this; - } + return this; + } })(jQuery);