Skip to content

Commit

Permalink
Refactor client init
Browse files Browse the repository at this point in the history
  • Loading branch information
ixti committed Aug 24, 2012
1 parent e30007d commit b862290
Show file tree
Hide file tree
Showing 4 changed files with 329 additions and 327 deletions.
57 changes: 0 additions & 57 deletions assets/javascripts/app.js
@@ -1,5 +1,3 @@
/*global nodeca, _, $, Modernizr, window, document*/

//= require store
//= require jquery/jquery
//= require jquery-ui/jquery-ui
Expand All @@ -14,58 +12,3 @@
//= require i18n
//= require views
//= require api
//= require_self

$(function () {
"use strict";
nodeca.client.init();
});

//
// Social buttons defered load - after all
//

$(window).load(function() {
'use strict';

setTimeout(function () {

// Twitter buttons

(function(d,s,id) {
var js, fjs = d.getElementsByTagName(s)[0];

if (!d.getElementById(id)) {
js = d.createElement(s);
js.id = id;
js.src = "//platform.twitter.com/widgets.js";

fjs.parentNode.insertBefore(js,fjs);
}
}(document, "script", "twitter-wjs"));

// Google +1

(function() {
var po = document.createElement('script');

po.type = 'text/javascript';
po.async = true;
po.src = 'https://apis.google.com/js/plusone.js';

var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(po, s);
}());

// Flattr

(function() {
var s = document.createElement('script'), t = document.getElementsByTagName('script')[0];
s.type = 'text/javascript';
s.async = true;
s.src = '//api.flattr.com/js/0.6/load.js?mode=auto';
t.parentNode.insertBefore(s, t);
}());

}, 1000);
});
7 changes: 5 additions & 2 deletions assets/javascripts/loader.js.ejs
Expand Up @@ -4,7 +4,7 @@


/*jshint browser:true,node:false*/
/*global yepnope*/
/*global yepnope, window*/


yepnope([
Expand All @@ -15,7 +15,10 @@ yepnope([
nope: <%- JSON.stringify(asset_path('json2.js')) %>
},
{
load: <%- JSON.stringify(asset_path('app.js')) %>
load: <%- JSON.stringify(asset_path('app.js')) %>,
complete: function () {
window.nodeca.client.init();
}
}
]);

Expand Down

0 comments on commit b862290

Please sign in to comment.