Commit 2f1d915d008a7f75702e2561653db0d38689a3c0
1 parent
b9bc7db9
Exists in
master
and in
8 other branches
Change 'Main' module to global and move 'oauthPluginHandle' function to global a…
…ccess like it was made before by Victor.
Showing
1 changed file
with
7 additions
and
7 deletions
Show diff stats
js/main.js
| 1 | 1 | define(['handlebars','handlebars_helpers'], function(Handlebars){ |
| 2 | 2 | |
| 3 | - | |
| 4 | 3 | /* global Handlebars, $ */ |
| 5 | 4 | // The template code |
| 6 | 5 | var templateSource = $('#proposal-template').html(); |
| ... | ... | @@ -170,7 +169,7 @@ define(['handlebars','handlebars_helpers'], function(Handlebars){ |
| 170 | 169 | $.ajax({ |
| 171 | 170 | type: 'post', |
| 172 | 171 | url: host + $form.attr('action'), |
| 173 | - data: $('#'+this.id).serialize() + '&private_token=' + private_token + '&fields=id&article[name]=article_' + guid() | |
| 172 | + data: $('#'+this.id).serialize() + '&private_token=' + private_token + '&fields=id&article[name]=article_' + Main.guid() | |
| 174 | 173 | }) |
| 175 | 174 | .done(function( /*data*/ ) { |
| 176 | 175 | form.reset(); |
| ... | ... | @@ -194,7 +193,7 @@ define(['handlebars','handlebars_helpers'], function(Handlebars){ |
| 194 | 193 | var BARRA_ADDED = false; |
| 195 | 194 | var HIDE_BARRA_DO_GOVERNO = false; |
| 196 | 195 | |
| 197 | - var Main = (function(){ | |
| 196 | + Main = (function(){ | |
| 198 | 197 | |
| 199 | 198 | return { |
| 200 | 199 | loadRandomProposal: function (topic_id, private_token) { |
| ... | ... | @@ -306,9 +305,6 @@ define(['handlebars','handlebars_helpers'], function(Handlebars){ |
| 306 | 305 | loginButton.siblings('.login-container').show(); |
| 307 | 306 | } |
| 308 | 307 | }, |
| 309 | - oauthPluginHandleLoginResult: function(loggedIn, token) { | |
| 310 | - loginCallback(loggedIn, token); | |
| 311 | - }, | |
| 312 | 308 | guid: function() { |
| 313 | 309 | function s4() { |
| 314 | 310 | return Math.floor((1 + Math.random()) * 0x10000) |
| ... | ... | @@ -544,7 +540,7 @@ define(['handlebars','handlebars_helpers'], function(Handlebars){ |
| 544 | 540 | //withCredentials: true |
| 545 | 541 | } |
| 546 | 542 | }).done(function(data) { |
| 547 | - loginCallback(true, data.private_token); | |
| 543 | + Main.loginCallback(true, data.private_token); | |
| 548 | 544 | }).fail(function( /*data*/ ) { |
| 549 | 545 | message.show(); |
| 550 | 546 | message.text('Não foi possível logar'); |
| ... | ... | @@ -553,6 +549,10 @@ define(['handlebars','handlebars_helpers'], function(Handlebars){ |
| 553 | 549 | }); |
| 554 | 550 | }); |
| 555 | 551 | |
| 552 | + window.oauthPluginHandleLoginResult = function(loggedIn, token) { | |
| 553 | + Main.loginCallback(loggedIn, token); | |
| 554 | + } | |
| 555 | + | |
| 556 | 556 | if('onhashchange' in window){ |
| 557 | 557 | |
| 558 | 558 | window.onhashchange = function(){ | ... | ... |