From 2f1d915d008a7f75702e2561653db0d38689a3c0 Mon Sep 17 00:00:00 2001 From: Michel Felipe Date: Thu, 30 Apr 2015 11:12:07 -0300 Subject: [PATCH] Change 'Main' module to global and move 'oauthPluginHandle' function to global access like it was made before by Victor. --- js/main.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/js/main.js b/js/main.js index ec669b9..7f37996 100644 --- a/js/main.js +++ b/js/main.js @@ -1,6 +1,5 @@ define(['handlebars','handlebars_helpers'], function(Handlebars){ - /* global Handlebars, $ */ // The template code var templateSource = $('#proposal-template').html(); @@ -170,7 +169,7 @@ define(['handlebars','handlebars_helpers'], function(Handlebars){ $.ajax({ type: 'post', url: host + $form.attr('action'), - data: $('#'+this.id).serialize() + '&private_token=' + private_token + '&fields=id&article[name]=article_' + guid() + data: $('#'+this.id).serialize() + '&private_token=' + private_token + '&fields=id&article[name]=article_' + Main.guid() }) .done(function( /*data*/ ) { form.reset(); @@ -194,7 +193,7 @@ define(['handlebars','handlebars_helpers'], function(Handlebars){ var BARRA_ADDED = false; var HIDE_BARRA_DO_GOVERNO = false; - var Main = (function(){ + Main = (function(){ return { loadRandomProposal: function (topic_id, private_token) { @@ -306,9 +305,6 @@ define(['handlebars','handlebars_helpers'], function(Handlebars){ loginButton.siblings('.login-container').show(); } }, - oauthPluginHandleLoginResult: function(loggedIn, token) { - loginCallback(loggedIn, token); - }, guid: function() { function s4() { return Math.floor((1 + Math.random()) * 0x10000) @@ -544,7 +540,7 @@ define(['handlebars','handlebars_helpers'], function(Handlebars){ //withCredentials: true } }).done(function(data) { - loginCallback(true, data.private_token); + Main.loginCallback(true, data.private_token); }).fail(function( /*data*/ ) { message.show(); message.text('Não foi possível logar'); @@ -553,6 +549,10 @@ define(['handlebars','handlebars_helpers'], function(Handlebars){ }); }); + window.oauthPluginHandleLoginResult = function(loggedIn, token) { + Main.loginCallback(loggedIn, token); + } + if('onhashchange' in window){ window.onhashchange = function(){ -- libgit2 0.21.2