Permalink
Browse files

Linting

  • Loading branch information...
1 parent e9983c7 commit e9f06895c479775edf0250f8fa525975cac02006 @beaugunderson beaugunderson committed Oct 8, 2012
Showing with 40 additions and 33 deletions.
  1. +36 −32 public/app.js
  2. +4 −1 views/index.ejs
View
68 public/app.js
@@ -1,44 +1,48 @@
+/*globals accessToken:true*/
+
// The URL of the Singly API endpoint
var apiBaseUrl = 'https://api.singly.com';
// A small wrapper for getting data from the Singly API
var singly = {
- get: function(url, options, callback) {
- if (options === undefined ||
- options === null) {
- options = {};
- }
+ get: function(url, options, callback) {
+ if (options === undefined ||
+ options === null) {
+ options = {};
+ }
- options.access_token = accessToken;
+ options.access_token = accessToken;
- $.getJSON(apiBaseUrl + url, options, callback);
- }
+ $.getJSON(apiBaseUrl + url, options, callback);
+ }
};
// Runs after the page has loaded
$(function() {
- // If there was no access token defined then return
- if (accessToken === 'undefined' ||
- accessToken === undefined) {
- return;
- }
-
- $('#access-token').val(accessToken);
- $('#access-token-wrapper').show();
-
- // Get the user's profiles
- singly.get('/profiles', null, function(profiles) {
- _.each(Object.keys(profiles), function(profile) {
- if(profile !== 'id') {
- $('#profiles').append(sprintf('<li><strong>Linked profile:</strong> %s</li>', profile));
- }
- });
- });
-
- // Get the 5 latest items from the user's statuses feed
- singly.get('/types/statuses_feed', { limit: 5 }, function(items) {
- _.each(items, function(item) {
- $('#statuses').append(sprintf('<li><strong>Status:</strong> %s</li>', item.oembed.text));
- });
- });
+ // If there was no access token defined then return
+ if (accessToken === 'undefined' ||
+ accessToken === undefined) {
+ return;
+ }
+
+ $('#access-token').val(accessToken);
+ $('#access-token-wrapper').show();
+
+ // Get the user's profiles
+ singly.get('/profiles', null, function(profiles) {
+ _.each(Object.keys(profiles), function(profile) {
+ if(profile !== 'id') {
+ $('#profiles').append(sprintf(
+ '<li><strong>Linked profile:</strong> %s</li>', profile));
+ }
+ });
+ });
+
+ // Get the 5 latest items from the user's statuses feed
+ singly.get('/types/statuses_feed', { limit: 5 }, function(items) {
+ _.each(items, function(item) {
+ $('#statuses').append(sprintf('<li><strong>Status:</strong> %s</li>',
+ item.oembed.text));
+ });
+ });
});
View
5 views/index.ejs
@@ -24,6 +24,9 @@
<div id="access-token-wrapper">
<p>Here's your access token for making API calls directly: <input type="text" id="access-token" /></p>
</div>
+
<div id="profiles"></div>
+
<hr>
-<div id="statuses"></div>
+
+<div id="statuses"></div>

0 comments on commit e9f0689

Please sign in to comment.