Commit f2639707ca3aaede03fd503d9fd5f99a05285962
Exists in
master
and in
5 other branches
Merge branch 'merlin'
Showing
2 changed files
with
154 additions
and
155 deletions
Show diff stats
index.html
| @@ -331,11 +331,11 @@ | @@ -331,11 +331,11 @@ | ||
| 331 | <p class="box-subtitle">{{stripTags (trimString abstract 200)}}</p> | 331 | <p class="box-subtitle">{{stripTags (trimString abstract 200)}}</p> |
| 332 | </div> | 332 | </div> |
| 333 | <div class="vote-actions"> | 333 | <div class="vote-actions"> |
| 334 | - <a href="#" class="icon icon-vote vote-action dislike" data-vote-value="-1"><span class="fa fa-times"></span></a> | ||
| 335 | - <a href="#" class="icon icon-vote vote-action like" data-vote-value="1"><span class="fa fa-check"></span></a> | 334 | + <button class="icon icon-vote vote-action dislike" data-vote-value="-1"><span class="fa fa-times"></span></button> |
| 335 | + <button class="icon icon-vote vote-action like" data-vote-value="1"><span class="fa fa-check"></span></button> | ||
| 336 | <div class="row"> | 336 | <div class="row"> |
| 337 | <div class="col-sm-6 col-sm-offset-3"> | 337 | <div class="col-sm-6 col-sm-offset-3"> |
| 338 | - <a href="#" class="skip button box-footer">Pular</a> | 338 | + <button class="skip button button-block box-footer">Pular</button> |
| 339 | </div> | 339 | </div> |
| 340 | </div> | 340 | </div> |
| 341 | <a href="#/programas/{{parent.id}}/resultados" class="vote-result box-bottom">Resultados</a> | 341 | <a href="#/programas/{{parent.id}}/resultados" class="vote-result box-bottom">Resultados</a> |
js/main.js
| 1 | -define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], function($, Handlebars, FastClick){ | ||
| 2 | - | ||
| 3 | - /* global Handlebars, $ */ | 1 | +/* global define */ |
| 2 | +define(['jquery', 'handlebars', 'fastclick', 'proposal_app', 'handlebars_helpers', 'piwik'], function($, Handlebars, FastClick, ProposalApp){ | ||
| 3 | + // 'use strict'; | ||
| 4 | + | ||
| 4 | // The template code | 5 | // The template code |
| 5 | var templateSource = $('#proposal-template').html(); | 6 | var templateSource = $('#proposal-template').html(); |
| 6 | 7 | ||
| @@ -21,36 +22,45 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | @@ -21,36 +22,45 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | ||
| 21 | 22 | ||
| 22 | var lastHash = window.location.hash; | 23 | var lastHash = window.location.hash; |
| 23 | 24 | ||
| 24 | - var participa = true; | 25 | + var host = 'http://login.dialoga.gov.br'; |
| 26 | + var dialoga_community = 19195; | ||
| 27 | + var proposal_discussion = '103358'; //participa | ||
| 28 | + var cat_saude = 180; | ||
| 29 | + // var cat_seguranca_publica = 182; | ||
| 30 | + // var cat_educacao = 181; | ||
| 31 | + // var cat_reducao_da_pobreza = 183; | ||
| 32 | + var recaptchaSiteKey = '6LcLPAcTAAAAAKsd0bxY_TArhD_A7OL19SRCW7_i'; | ||
| 25 | 33 | ||
| 26 | 34 | ||
| 27 | //Detects for localhost settings | 35 | //Detects for localhost settings |
| 28 | - var patt = new RegExp(":3001/"); | ||
| 29 | - if(patt.test(window.location.href)) | ||
| 30 | - participa = false; | ||
| 31 | - | ||
| 32 | - if(participa){ | ||
| 33 | - var host = 'http://login.dialoga.gov.br'; | ||
| 34 | - window.dialoga_community = 19195; | ||
| 35 | - proposal_discussion = '103358'; //participa | ||
| 36 | - var cat_saude = 180; | ||
| 37 | - var cat_seguranca_publica = 182; | ||
| 38 | - var cat_educacao = 181; | ||
| 39 | - var cat_reducao_da_pobreza = 183; | ||
| 40 | - window.recaptchaSiteKey = '6LcLPAcTAAAAAKsd0bxY_TArhD_A7OL19SRCW7_i' | ||
| 41 | - }else{ | ||
| 42 | - var host = 'http://noosfero.com:3001'; | ||
| 43 | - window.dialoga_community = 104; | ||
| 44 | -// var proposal_discussion = '392'; //local serpro | ||
| 45 | - var proposal_discussion = '413'; //casa | ||
| 46 | - window.recaptchaSiteKey = '6LdsWAcTAAAAAChTUUD6yu9fCDhdIZzNd7F53zf-' //http://noosfero.com/ | ||
| 47 | - var cat_saude = 23; | 36 | + var patt = new RegExp(':3001/'); |
| 37 | + if(patt.test(window.location.href)){ | ||
| 38 | + host = 'http://noosfero.com:3001'; | ||
| 39 | + dialoga_community = 104; | ||
| 40 | + proposal_discussion = '413'; //casa | ||
| 41 | + recaptchaSiteKey = '6LdsWAcTAAAAAChTUUD6yu9fCDhdIZzNd7F53zf-'; //http://noosfero.com/ | ||
| 42 | + cat_saude = 23; | ||
| 48 | } | 43 | } |
| 49 | - window.proposal_discussion = proposal_discussion; | 44 | + |
| 50 | var BARRA_ADDED = false; | 45 | var BARRA_ADDED = false; |
| 51 | var HIDE_BARRA_DO_GOVERNO = false; | 46 | var HIDE_BARRA_DO_GOVERNO = false; |
| 52 | 47 | ||
| 53 | - Main = (function(){ | 48 | + var Main; |
| 49 | + window.Main = Main = (function(){ | ||
| 50 | + | ||
| 51 | + var API = { | ||
| 52 | + articles: '', | ||
| 53 | + proposals: '/api/v1/articles/{topic_id}/children', | ||
| 54 | + | ||
| 55 | + }; | ||
| 56 | + | ||
| 57 | + API.getProposalsURL = function (topicId){ | ||
| 58 | + return host + replace(API.proposals, '{topic_id}', topicId); | ||
| 59 | + }; | ||
| 60 | + | ||
| 61 | + function replace(str, pattern, value){ | ||
| 62 | + return str.replace(new RegExp(pattern, 'g'), value); | ||
| 63 | + } | ||
| 54 | 64 | ||
| 55 | return { | 65 | return { |
| 56 | private_token: '375bee7e17d0021af7160ce664874618', | 66 | private_token: '375bee7e17d0021af7160ce664874618', |
| @@ -67,8 +77,8 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | @@ -67,8 +77,8 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | ||
| 67 | 77 | ||
| 68 | return proposalId; | 78 | return proposalId; |
| 69 | }, | 79 | }, |
| 70 | - loadRandomProposal: function (topic_id) { | ||
| 71 | - var private_token = Main.private_token; | 80 | + loadRandomProposal: function (topic_id, force) { |
| 81 | + var private_token = window.Main.private_token; | ||
| 72 | var $noProposals = $('.no-proposals'); | 82 | var $noProposals = $('.no-proposals'); |
| 73 | var $loading = $('.loading'); | 83 | var $loading = $('.loading'); |
| 74 | var $randomProposal = $('.random-proposal'); | 84 | var $randomProposal = $('.random-proposal'); |
| @@ -80,13 +90,13 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | @@ -80,13 +90,13 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | ||
| 80 | $loading.show(); | 90 | $loading.show(); |
| 81 | $randomProposal.html(''); | 91 | $randomProposal.html(''); |
| 82 | 92 | ||
| 83 | - var url = host + '/api/v1/articles/' + topic_id + '/children'; | 93 | + var url = API.getProposalsURL(topic_id); |
| 84 | var childId = this.getProposalId(); | 94 | var childId = this.getProposalId(); |
| 85 | 95 | ||
| 86 | - if(childId != 0){ | ||
| 87 | - url += '/'+childId; | 96 | + if(childId !== 0 && !force){ |
| 97 | + url += '/' + childId; | ||
| 88 | } | 98 | } |
| 89 | - url += '?private_token=' + Main.private_token + '&limit=1&order=random()&_='+new Date().getTime()+'&fields=id,name,slug,abstract,created_by&content_type=ProposalsDiscussionPlugin::Proposal'; | 99 | + url += '?private_token=' + private_token + '&limit=1&order=random()&_='+new Date().getTime()+'&fields=id,name,slug,abstract,created_by&content_type=ProposalsDiscussionPlugin::Proposal'; |
| 90 | 100 | ||
| 91 | $.getJSON(url).done(function( data ) { | 101 | $.getJSON(url).done(function( data ) { |
| 92 | $loading.hide(); | 102 | $loading.hide(); |
| @@ -104,25 +114,24 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | @@ -104,25 +114,24 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | ||
| 104 | $randomProposal.html(supportProposalTemplate(article)); | 114 | $randomProposal.html(supportProposalTemplate(article)); |
| 105 | $body.off('click', '.vote-actions .skip'); | 115 | $body.off('click', '.vote-actions .skip'); |
| 106 | $body.on('click', '.vote-actions .skip', function(e) { | 116 | $body.on('click', '.vote-actions .skip', function(e) { |
| 107 | - contextMain.loadRandomProposal(topic_id); | ||
| 108 | e.preventDefault(); | 117 | e.preventDefault(); |
| 118 | + contextMain.loadRandomProposal(topic_id, true); | ||
| 109 | }); | 119 | }); |
| 110 | $body.off('click', '.vote-actions .vote-action'); | 120 | $body.off('click', '.vote-actions .vote-action'); |
| 111 | $body.on('click', '.vote-actions .vote-action', function(e) { | 121 | $body.on('click', '.vote-actions .vote-action', function(e) { |
| 112 | //Helps to prevent more than one vote per proposal | 122 | //Helps to prevent more than one vote per proposal |
| 113 | var button = $(this); | 123 | var button = $(this); |
| 124 | + e.preventDefault(); | ||
| 114 | 125 | ||
| 115 | if(!logged_in) { | 126 | if(!logged_in) { |
| 116 | $(this).closest('.require-login-container').find('.button-send a').click(); | 127 | $(this).closest('.require-login-container').find('.button-send a').click(); |
| 117 | - e.preventDefault(); | ||
| 118 | return; | 128 | return; |
| 119 | } | 129 | } |
| 120 | 130 | ||
| 121 | if(ProposalApp.hasProposalbeenVoted(article.id)){ | 131 | if(ProposalApp.hasProposalbeenVoted(article.id)){ |
| 122 | // console.debug("Proposta " + article.id + " já havia sido votada"); | 132 | // console.debug("Proposta " + article.id + " já havia sido votada"); |
| 123 | Main.displaySuccess(button.closest('.support-proposal .section-content'), 'Seu voto já foi computado nesta proposta', 800); | 133 | Main.displaySuccess(button.closest('.support-proposal .section-content'), 'Seu voto já foi computado nesta proposta', 800); |
| 124 | - contextMain.loadRandomProposal(topic_id); | ||
| 125 | - e.preventDefault(); | 134 | + contextMain.loadRandomProposal(topic_id, true); |
| 126 | return; | 135 | return; |
| 127 | } | 136 | } |
| 128 | 137 | ||
| @@ -140,9 +149,8 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | @@ -140,9 +149,8 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | ||
| 140 | Main.displaySuccess(button.closest('.support-proposal .section-content'), 'Seu voto já foi computado nesta proposta', 800); | 149 | Main.displaySuccess(button.closest('.support-proposal .section-content'), 'Seu voto já foi computado nesta proposta', 800); |
| 141 | } | 150 | } |
| 142 | ProposalApp.addVotedProposal(article.id); | 151 | ProposalApp.addVotedProposal(article.id); |
| 143 | - contextMain.loadRandomProposal(topic_id); | 152 | + contextMain.loadRandomProposal(topic_id, true); |
| 144 | }); | 153 | }); |
| 145 | - e.preventDefault(); | ||
| 146 | }); | 154 | }); |
| 147 | 155 | ||
| 148 | $body.off('click', '.vote-result'); | 156 | $body.off('click', '.vote-result'); |
| @@ -166,12 +174,6 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | @@ -166,12 +174,6 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | ||
| 166 | } | 174 | } |
| 167 | }); | 175 | }); |
| 168 | 176 | ||
| 169 | - // $body.off('click', '.question-link'); | ||
| 170 | - // $body.on('click', '.question-link', function(e) { | ||
| 171 | - // var $this = $(this); | ||
| 172 | - | ||
| 173 | - // // Main.navigateTo($this.attr('href'), backTo); | ||
| 174 | - // }); | ||
| 175 | }).fail(function(){ | 177 | }).fail(function(){ |
| 176 | $loading.hide(); | 178 | $loading.hide(); |
| 177 | $('.support-proposal .alert').show(); | 179 | $('.support-proposal .alert').show(); |
| @@ -196,7 +198,7 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | @@ -196,7 +198,7 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | ||
| 196 | $resultsContainer.html(resultsTemplate(data)); | 198 | $resultsContainer.html(resultsTemplate(data)); |
| 197 | $resultsContainer.find('.loading').hide(); | 199 | $resultsContainer.find('.loading').hide(); |
| 198 | $resultsContainer.find('.results-content').show(); | 200 | $resultsContainer.find('.results-content').show(); |
| 199 | - $(".timeago").timeago(); | 201 | + $('.timeago').timeago(); |
| 200 | $resultsContainer.show(); | 202 | $resultsContainer.show(); |
| 201 | 203 | ||
| 202 | $('.footable').footable(); | 204 | $('.footable').footable(); |
| @@ -401,7 +403,7 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | @@ -401,7 +403,7 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | ||
| 401 | }) | 403 | }) |
| 402 | .fail(function( jqxhr, textStatus, error ) { | 404 | .fail(function( jqxhr, textStatus, error ) { |
| 403 | var err = textStatus + ', ' + error; | 405 | var err = textStatus + ', ' + error; |
| 404 | - // console.log( 'Request Failed: ' + err ); | 406 | + console.error( 'Request Failed: ' + err ); |
| 405 | }); | 407 | }); |
| 406 | }, | 408 | }, |
| 407 | display_proposal_by_category: function(item){ | 409 | display_proposal_by_category: function(item){ |
| @@ -504,7 +506,7 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | @@ -504,7 +506,7 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | ||
| 504 | var regexResultados = /resultados$/; | 506 | var regexResultados = /resultados$/; |
| 505 | var regexSobreOPrograma = /sobre-o-programa$/; | 507 | var regexSobreOPrograma = /sobre-o-programa$/; |
| 506 | 508 | ||
| 507 | - if( !(regexHideBarra.exec(hash) !== null) && !HIDE_BARRA_DO_GOVERNO ){ | 509 | + if( (regexHideBarra.exec(hash) === null) && !HIDE_BARRA_DO_GOVERNO ){ |
| 508 | this.addBarraDoGoverno(); | 510 | this.addBarraDoGoverno(); |
| 509 | }else{ | 511 | }else{ |
| 510 | HIDE_BARRA_DO_GOVERNO = true; | 512 | HIDE_BARRA_DO_GOVERNO = true; |
| @@ -525,6 +527,8 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | @@ -525,6 +527,8 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | ||
| 525 | this.display_article(hash.split('/')[2], lastHash); | 527 | this.display_article(hash.split('/')[2], lastHash); |
| 526 | } | 528 | } |
| 527 | 529 | ||
| 530 | + var proposalTitle; | ||
| 531 | + | ||
| 528 | if( isProposal ){ | 532 | if( isProposal ){ |
| 529 | 533 | ||
| 530 | // go to proposal | 534 | // go to proposal |
| @@ -532,8 +536,9 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | @@ -532,8 +536,9 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | ||
| 532 | this.navigateToProposal(proposalId); | 536 | this.navigateToProposal(proposalId); |
| 533 | 537 | ||
| 534 | var $proposal = $('#proposal-item-' + proposalId); | 538 | var $proposal = $('#proposal-item-' + proposalId); |
| 535 | - var proposalTitle = $proposal.find('.title').text(); | 539 | + proposalTitle = $proposal.find('.title').text(); |
| 536 | var proposalOffset = $proposal.offset(); | 540 | var proposalOffset = $proposal.offset(); |
| 541 | + | ||
| 537 | if(proposalOffset){ | 542 | if(proposalOffset){ |
| 538 | scrollTop = proposalOffset.top; | 543 | scrollTop = proposalOffset.top; |
| 539 | }else{ | 544 | }else{ |
| @@ -550,22 +555,24 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | @@ -550,22 +555,24 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | ||
| 550 | if($resultsContainer.css('display') === 'none') { | 555 | if($resultsContainer.css('display') === 'none') { |
| 551 | Main.loadRanking($resultsContainer, proposalId, 1); | 556 | Main.loadRanking($resultsContainer, proposalId, 1); |
| 552 | } else { | 557 | } else { |
| 553 | - $proposalDetail.find('.experience-proposal-container').show(); | ||
| 554 | - $proposalDetail.find('.talk-proposal-container').show(); | 558 | + $proposal.find('.experience-proposal-container').show(); |
| 559 | + $proposal.find('.talk-proposal-container').show(); | ||
| 555 | $resultsContainer.hide(); | 560 | $resultsContainer.hide(); |
| 556 | } | 561 | } |
| 557 | 562 | ||
| 558 | - var proposalOffset = $resultsContainer.offset(); | 563 | + proposalOffset = $resultsContainer.offset(); |
| 559 | if(proposalOffset){ | 564 | if(proposalOffset){ |
| 560 | scrollTop = proposalOffset.top; | 565 | scrollTop = proposalOffset.top; |
| 561 | } | 566 | } |
| 562 | } | 567 | } |
| 563 | } | 568 | } |
| 564 | 569 | ||
| 570 | + var categorySlug; | ||
| 571 | + | ||
| 565 | if( isCategory ){ | 572 | if( isCategory ){ |
| 566 | 573 | ||
| 567 | // go to category | 574 | // go to category |
| 568 | - var categorySlug = parts[2]; | 575 | + categorySlug = parts[2]; |
| 569 | var categoryId = parts[3]; | 576 | var categoryId = parts[3]; |
| 570 | this.navigateToCategory(categoryId); | 577 | this.navigateToCategory(categoryId); |
| 571 | 578 | ||
| @@ -594,7 +601,7 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | @@ -594,7 +601,7 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | ||
| 594 | 601 | ||
| 595 | var trackPageTitle = ''; | 602 | var trackPageTitle = ''; |
| 596 | if(isArticle){ | 603 | if(isArticle){ |
| 597 | - trackPageTitle = 'Página: Sobre' | 604 | + trackPageTitle = 'Página: Sobre'; |
| 598 | } | 605 | } |
| 599 | 606 | ||
| 600 | if(isProposal){ | 607 | if(isProposal){ |
| @@ -624,7 +631,7 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | @@ -624,7 +631,7 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | ||
| 624 | var regexSobreOPrograma = /sobre-o-programa$/; | 631 | var regexSobreOPrograma = /sobre-o-programa$/; |
| 625 | if(proposalId === undefined){ | 632 | if(proposalId === undefined){ |
| 626 | this.display_proposals_tab(); | 633 | this.display_proposals_tab(); |
| 627 | - }else if(regexSobreOPrograma.exec(window.location.hash) == null){ | 634 | + }else if(regexSobreOPrograma.exec(window.location.hash) === null){ |
| 628 | this.display_proposal('proposal-item-' + proposalId); | 635 | this.display_proposal('proposal-item-' + proposalId); |
| 629 | }else{ | 636 | }else{ |
| 630 | this.display_proposal_detail(proposalId); | 637 | this.display_proposal_detail(proposalId); |
| @@ -638,11 +645,13 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | @@ -638,11 +645,13 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | ||
| 638 | } | 645 | } |
| 639 | }, | 646 | }, |
| 640 | oauthClientAction: function(url) { | 647 | oauthClientAction: function(url) { |
| 641 | - var child = window.open(url, "_blank"); | 648 | + var child = window.open(url, '_blank'); |
| 642 | var interval = setInterval(function() { | 649 | var interval = setInterval(function() { |
| 643 | try { | 650 | try { |
| 644 | if(!child.closed) { | 651 | if(!child.closed) { |
| 645 | - child.postMessage({ message: "requestOauthClientPluginResult" }, "*"); | 652 | + child.postMessage({ |
| 653 | + message: 'requestOauthClientPluginResult' | ||
| 654 | + }, '*'); | ||
| 646 | } | 655 | } |
| 647 | } | 656 | } |
| 648 | catch(e) { | 657 | catch(e) { |
| @@ -662,10 +671,10 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | @@ -662,10 +671,10 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | ||
| 662 | successPanel.find('.message').html(text); | 671 | successPanel.find('.message').html(text); |
| 663 | successPanel.appendTo(container.closest('.categories')); | 672 | successPanel.appendTo(container.closest('.categories')); |
| 664 | successPanel.show(); | 673 | successPanel.show(); |
| 665 | - successPanel.css("top", Math.max(0, ((container.height() - successPanel.outerHeight()) / 2) + container.offset().top) + "px"); | ||
| 666 | - successPanel.css("left", Math.max(0, ((container.width() - successPanel.outerWidth()) / 2) + container.offset().left) + "px"); | 674 | + successPanel.css('top', Math.max(0, ((container.height() - successPanel.outerHeight()) / 2) + container.offset().top) + 'px'); |
| 675 | + successPanel.css('left', Math.max(0, ((container.width() - successPanel.outerWidth()) / 2) + container.offset().left) + 'px'); | ||
| 667 | 676 | ||
| 668 | - var interval = setTimeout(function() { | 677 | + setTimeout(function() { |
| 669 | successPanel.hide(); | 678 | successPanel.hide(); |
| 670 | container.css('opacity', 1); | 679 | container.css('opacity', 1); |
| 671 | successPanel.remove(); | 680 | successPanel.remove(); |
| @@ -693,28 +702,32 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | @@ -693,28 +702,32 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | ||
| 693 | }, | 702 | }, |
| 694 | responseToText: function(responseJSONmessage){ | 703 | responseToText: function(responseJSONmessage){ |
| 695 | var o = JSON.parse(responseJSONmessage); | 704 | var o = JSON.parse(responseJSONmessage); |
| 696 | - var msg = ""; | 705 | + var msg = ''; |
| 697 | var fn; | 706 | var fn; |
| 698 | 707 | ||
| 699 | for (var key in o) { | 708 | for (var key in o) { |
| 700 | if (o[key] instanceof Array) { | 709 | if (o[key] instanceof Array) { |
| 701 | fn = key; | 710 | fn = key; |
| 702 | for (var i = 0; i < o[key].length; i++) { | 711 | for (var i = 0; i < o[key].length; i++) { |
| 703 | - msg += fn + " " + o[key][i] + "</br>"; | 712 | + msg += fn + ' ' + o[key][i] + '</br>'; |
| 704 | } | 713 | } |
| 705 | } | 714 | } |
| 706 | } | 715 | } |
| 707 | - msg = msg.replace('password_confirmation', "campo 'confirmação da senha'"); | ||
| 708 | - msg = msg.replace(/password/g, "campo 'senha'"); | ||
| 709 | - msg = msg.replace('login', "campo 'nome de usuário'"); | ||
| 710 | - msg = msg.replace('email', "campo 'e-mail'"); | ||
| 711 | - msg = msg.substring(0, msg.length - 5) + "."; | 716 | + msg = msg.replace('password_confirmation', 'campo "confirmação da senha"'); |
| 717 | + msg = msg.replace(/password/g, 'campo "senha"'); | ||
| 718 | + msg = msg.replace('login', 'campo "nome de usuário"'); | ||
| 719 | + msg = msg.replace('email', 'campo "e-mail"'); | ||
| 720 | + msg = msg.substring(0, msg.length - 5) + '.'; | ||
| 712 | return msg; | 721 | return msg; |
| 713 | }, | 722 | }, |
| 714 | display_events: function(cat_id, active_category) { | 723 | display_events: function(cat_id, active_category) { |
| 715 | - var url = host + '/api/v1/communities/' + window.dialoga_community + '/articles?categories_ids[]=' + cat_id + '&content_type=Event&private_token=' + '375bee7e17d0021af7160ce664874618'; | 724 | + var url = host + '/api/v1/communities/' + dialoga_community + '/articles?categories_ids[]=' + cat_id + '&content_type=Event&private_token=' + '375bee7e17d0021af7160ce664874618'; |
| 716 | $.getJSON(url).done(function (data) { | 725 | $.getJSON(url).done(function (data) { |
| 717 | - if(data.articles.length==0) return; | 726 | + |
| 727 | + if(data.articles.length === 0){ | ||
| 728 | + return; | ||
| 729 | + } | ||
| 730 | + | ||
| 718 | var dt = data.articles[0].start_date; | 731 | var dt = data.articles[0].start_date; |
| 719 | var date = dt.substr(8, 2) + '/' + dt.substr(5, 2) + '/' + dt.substr(0, 4); | 732 | var date = dt.substr(8, 2) + '/' + dt.substr(5, 2) + '/' + dt.substr(0, 4); |
| 720 | var dd = new Date(dt); | 733 | var dd = new Date(dt); |
| @@ -722,7 +735,7 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | @@ -722,7 +735,7 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | ||
| 722 | var params = {event: data.articles[0], date: date, time: time, category: data.articles[0].categories[0].name, category_class: active_category}; | 735 | var params = {event: data.articles[0], date: date, time: time, category: data.articles[0].categories[0].name, category_class: active_category}; |
| 723 | $.getJSON(host+'/api/v1/articles/'+data.articles[0].id+'/followers?private_token=' + '375bee7e17d0021af7160ce664874618' + '&_='+new Date().getTime()).done(function (data) { | 736 | $.getJSON(host+'/api/v1/articles/'+data.articles[0].id+'/followers?private_token=' + '375bee7e17d0021af7160ce664874618' + '&_='+new Date().getTime()).done(function (data) { |
| 724 | //FIXME do not depend on this request | 737 | //FIXME do not depend on this request |
| 725 | - params['total_followers'] = data.total_followers; | 738 | + params.total_followers = data.total_followers; |
| 726 | $('.calendar-container').html(calendarTemplate(params)); | 739 | $('.calendar-container').html(calendarTemplate(params)); |
| 727 | $('.calendar-container .calendar.' + active_category).show(); | 740 | $('.calendar-container .calendar.' + active_category).show(); |
| 728 | // $('.calendar-container .calendar').slick(); | 741 | // $('.calendar-container .calendar').slick(); |
| @@ -770,7 +783,7 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | @@ -770,7 +783,7 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | ||
| 770 | var $paragraph = $proposalItemEl.find('p'); | 783 | var $paragraph = $proposalItemEl.find('p'); |
| 771 | var lines = Main.computeLines($paragraph); | 784 | var lines = Main.computeLines($paragraph); |
| 772 | if(lines > maxLinesByParagraph ){ | 785 | if(lines > maxLinesByParagraph ){ |
| 773 | - maxLinesByParagraph = lines | 786 | + maxLinesByParagraph = lines; |
| 774 | } | 787 | } |
| 775 | }); | 788 | }); |
| 776 | // console.log('maxLinesByParagraph', maxLinesByParagraph); | 789 | // console.log('maxLinesByParagraph', maxLinesByParagraph); |
| @@ -781,7 +794,7 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | @@ -781,7 +794,7 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | ||
| 781 | var $title = $proposalItemEl.find('.box__title'); | 794 | var $title = $proposalItemEl.find('.box__title'); |
| 782 | var lines = Main.computeLines($title); | 795 | var lines = Main.computeLines($title); |
| 783 | if(lines > maxLinesByTitle ){ | 796 | if(lines > maxLinesByTitle ){ |
| 784 | - maxLinesByTitle = lines | 797 | + maxLinesByTitle = lines; |
| 785 | } | 798 | } |
| 786 | }); | 799 | }); |
| 787 | // console.log('maxLinesByTitle', maxLinesByTitle); | 800 | // console.log('maxLinesByTitle', maxLinesByTitle); |
| @@ -818,9 +831,9 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | @@ -818,9 +831,9 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | ||
| 818 | Main.loginCallback(true, data.private_token); | 831 | Main.loginCallback(true, data.private_token); |
| 819 | }, | 832 | }, |
| 820 | handleLoginFail: function (e){ | 833 | handleLoginFail: function (e){ |
| 821 | - // console.log('Event', e); | 834 | + console.error('handleLoginFail', e); |
| 822 | } | 835 | } |
| 823 | - } | 836 | + }; |
| 824 | })(); | 837 | })(); |
| 825 | 838 | ||
| 826 | 839 | ||
| @@ -848,7 +861,7 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | @@ -848,7 +861,7 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | ||
| 848 | var url = abstract.substring(startSrcUrl , endSrcUrl); | 861 | var url = abstract.substring(startSrcUrl , endSrcUrl); |
| 849 | // console.log('url', url); | 862 | // console.log('url', url); |
| 850 | 863 | ||
| 851 | - if(url.indexOf("wmode=opaque") !== -1){ | 864 | + if(url.indexOf('wmode=opaque') !== -1){ |
| 852 | // already in opaque mode | 865 | // already in opaque mode |
| 853 | // console.debug('already in opaque mode'); | 866 | // console.debug('already in opaque mode'); |
| 854 | return; | 867 | return; |
| @@ -858,10 +871,11 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | @@ -858,10 +871,11 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | ||
| 858 | c = '&'; | 871 | c = '&'; |
| 859 | } | 872 | } |
| 860 | 873 | ||
| 861 | - var resultUrl = url+c+"wmode=opaque"; | 874 | + var resultUrl = url + c + 'wmode=opaque'; |
| 862 | article.abstract = abstract.replace(url, resultUrl); | 875 | article.abstract = abstract.replace(url, resultUrl); |
| 863 | // console.log('article.abstract', article.abstract); | 876 | // console.log('article.abstract', article.abstract); |
| 864 | - }; | 877 | + } |
| 878 | + | ||
| 865 | forceWmodeIframe(data.article); | 879 | forceWmodeIframe(data.article); |
| 866 | 880 | ||
| 867 | resultsPlaceholder.innerHTML = template(data); | 881 | resultsPlaceholder.innerHTML = template(data); |
| @@ -919,7 +933,7 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | @@ -919,7 +933,7 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | ||
| 919 | $(document).keyup(function(e) { | 933 | $(document).keyup(function(e) { |
| 920 | 934 | ||
| 921 | // escape key maps to keycode `27` | 935 | // escape key maps to keycode `27` |
| 922 | - if (e.keyCode == 27) { // ESC | 936 | + if (e.keyCode === 27) { // ESC |
| 923 | $loginPanel.hide(); | 937 | $loginPanel.hide(); |
| 924 | } | 938 | } |
| 925 | }); | 939 | }); |
| @@ -977,7 +991,7 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | @@ -977,7 +991,7 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | ||
| 977 | // return to proposal page | 991 | // return to proposal page |
| 978 | newHash = oldHash.split('/sobre-o-programa')[0]; | 992 | newHash = oldHash.split('/sobre-o-programa')[0]; |
| 979 | }else{ | 993 | }else{ |
| 980 | - $link = $(this).siblings('.proposal-link'); | 994 | + var $link = $(this).siblings('.proposal-link'); |
| 981 | newHash = $link.attr('href'); | 995 | newHash = $link.attr('href'); |
| 982 | } | 996 | } |
| 983 | 997 | ||
| @@ -1027,10 +1041,10 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | @@ -1027,10 +1041,10 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | ||
| 1027 | Main.updateHash($link.attr('href')); | 1041 | Main.updateHash($link.attr('href')); |
| 1028 | }); | 1042 | }); |
| 1029 | 1043 | ||
| 1030 | - $( '.proposal-selection' ).change(function(e){ | 1044 | + $( '.proposal-selection' ).change(function(){ |
| 1031 | // Update URL and Navigate | 1045 | // Update URL and Navigate |
| 1032 | Main.updateHash('#/programas/' + this.value); | 1046 | Main.updateHash('#/programas/' + this.value); |
| 1033 | - $(this).val($(this).data("proposal")).trigger("chosen:updated"); | 1047 | + $(this).val($(this).data('proposal')).trigger('chosen:updated'); |
| 1034 | }); | 1048 | }); |
| 1035 | 1049 | ||
| 1036 | var availableTags = [ ]; | 1050 | var availableTags = [ ]; |
| @@ -1055,8 +1069,8 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | @@ -1055,8 +1069,8 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | ||
| 1055 | 1069 | ||
| 1056 | $('.save-article-form').submit(function (e) { | 1070 | $('.save-article-form').submit(function (e) { |
| 1057 | e.preventDefault(); | 1071 | e.preventDefault(); |
| 1058 | - var proposal_id = this.id.split('-').pop(); | ||
| 1059 | - var form = this; | 1072 | + // var proposal_id = this.id.split('-').pop(); |
| 1073 | + // var form = this; | ||
| 1060 | var $form = $(this); | 1074 | var $form = $(this); |
| 1061 | var $message = $form.find('.message'); | 1075 | var $message = $form.find('.message'); |
| 1062 | $message.hide(); | 1076 | $message.hide(); |
| @@ -1076,7 +1090,7 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | @@ -1076,7 +1090,7 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | ||
| 1076 | }) | 1090 | }) |
| 1077 | .fail(function( jqxhr, textStatus, error ) { | 1091 | .fail(function( jqxhr, textStatus, error ) { |
| 1078 | var err = textStatus + ', ' + error; | 1092 | var err = textStatus + ', ' + error; |
| 1079 | - // console.log( 'Request Failed: ' + err ); | 1093 | + console.error( 'Request Failed: ' + err ); |
| 1080 | $message.show(); | 1094 | $message.show(); |
| 1081 | $message.text('Não foi possível enviar.'); | 1095 | $message.text('Não foi possível enviar.'); |
| 1082 | }); | 1096 | }); |
| @@ -1084,7 +1098,7 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | @@ -1084,7 +1098,7 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | ||
| 1084 | }) | 1098 | }) |
| 1085 | .fail(function( jqxhr, textStatus, error ) { | 1099 | .fail(function( jqxhr, textStatus, error ) { |
| 1086 | var err = textStatus + ', ' + error; | 1100 | var err = textStatus + ', ' + error; |
| 1087 | - // console.log( 'Request Failed: ' + err ); | 1101 | + console.error( 'Request Failed: ' + err ); |
| 1088 | }); | 1102 | }); |
| 1089 | 1103 | ||
| 1090 | $(document).ready(function($) { | 1104 | $(document).ready(function($) { |
| @@ -1151,7 +1165,7 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | @@ -1151,7 +1165,7 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | ||
| 1151 | }).fail(function(data) { | 1165 | }).fail(function(data) { |
| 1152 | 1166 | ||
| 1153 | $message.show(); | 1167 | $message.show(); |
| 1154 | - if(data.status==401){ | 1168 | + if(data.status === 401){ |
| 1155 | $message.text('Nome de usuário, e-mail ou senha incorretos, não foi possível acessar.'); | 1169 | $message.text('Nome de usuário, e-mail ou senha incorretos, não foi possível acessar.'); |
| 1156 | }else{ | 1170 | }else{ |
| 1157 | $message.text('Um erro inesperado ocorreu'); | 1171 | $message.text('Um erro inesperado ocorreu'); |
| @@ -1176,24 +1190,32 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | @@ -1176,24 +1190,32 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | ||
| 1176 | }); | 1190 | }); |
| 1177 | 1191 | ||
| 1178 | $(document).on('click', '.new-user', function(e) { | 1192 | $(document).on('click', '.new-user', function(e) { |
| 1179 | - if(window.lastCaptcha) | 1193 | + |
| 1194 | + if(window.lastCaptcha){ | ||
| 1180 | window.lastCaptcha.destruir(); | 1195 | window.lastCaptcha.destruir(); |
| 1196 | + } | ||
| 1197 | + | ||
| 1181 | var loginForm = $(this).parents('#login-form'); | 1198 | var loginForm = $(this).parents('#login-form'); |
| 1182 | var signupForm = loginForm.siblings('#signup-form'); | 1199 | var signupForm = loginForm.siblings('#signup-form'); |
| 1183 | window.signupForm = signupForm; | 1200 | window.signupForm = signupForm; |
| 1201 | + | ||
| 1184 | loginForm.hide(); | 1202 | loginForm.hide(); |
| 1185 | signupForm.show(); | 1203 | signupForm.show(); |
| 1186 | - signupForm.find(".password").show(); | ||
| 1187 | - signupForm.find(".password-confirmation").show(); | 1204 | + |
| 1205 | + signupForm.find('.password').show(); | ||
| 1206 | + signupForm.find('.password-confirmation').show(); | ||
| 1188 | loginForm.find('.message').hide(); | 1207 | loginForm.find('.message').hide(); |
| 1189 | signupForm.find('#serpro_captcha').empty(); | 1208 | signupForm.find('#serpro_captcha').empty(); |
| 1209 | + | ||
| 1190 | var oCaptcha_serpro_gov_br; | 1210 | var oCaptcha_serpro_gov_br; |
| 1191 | oCaptcha_serpro_gov_br = new captcha_serpro_gov_br(); | 1211 | oCaptcha_serpro_gov_br = new captcha_serpro_gov_br(); |
| 1192 | window.lastCaptcha = oCaptcha_serpro_gov_br; | 1212 | window.lastCaptcha = oCaptcha_serpro_gov_br; |
| 1193 | - oCaptcha_serpro_gov_br.clienteId = "fdbcdc7a0b754ee7ae9d865fda740f17"; | ||
| 1194 | - oCaptcha_serpro_gov_br.criarUI(signupForm.find('#serpro_captcha')[0], "css", "input", "serpro_captcha_component_"); | 1213 | + |
| 1214 | + oCaptcha_serpro_gov_br.clienteId = 'fdbcdc7a0b754ee7ae9d865fda740f17'; | ||
| 1215 | + oCaptcha_serpro_gov_br.criarUI(signupForm.find('#serpro_captcha')[0], 'css', 'input', 'serpro_captcha_component_'); | ||
| 1216 | + | ||
| 1195 | e.preventDefault(); | 1217 | e.preventDefault(); |
| 1196 | - }) | 1218 | + }); |
| 1197 | 1219 | ||
| 1198 | $(document).on('click', '.cancel-signup', function(e) { | 1220 | $(document).on('click', '.cancel-signup', function(e) { |
| 1199 | var signupForm = $(this).parents('#signup-form'); | 1221 | var signupForm = $(this).parents('#signup-form'); |
| @@ -1223,7 +1245,7 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | @@ -1223,7 +1245,7 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | ||
| 1223 | var hasUsername = $inputUsername && $inputUsername.val().length > 0; | 1245 | var hasUsername = $inputUsername && $inputUsername.val().length > 0; |
| 1224 | var hasPassword = $inputPassword && $inputPassword.val().length > 0; | 1246 | var hasPassword = $inputPassword && $inputPassword.val().length > 0; |
| 1225 | var hasPasswordConfirmation = $inputPasswordConfirmation && $inputPasswordConfirmation.val().length > 0; | 1247 | var hasPasswordConfirmation = $inputPasswordConfirmation && $inputPasswordConfirmation.val().length > 0; |
| 1226 | - var hasPasswordEquals = $inputPassword.val() == $inputPasswordConfirmation.val(); | 1248 | + var hasPasswordEquals = $inputPassword.val() === $inputPasswordConfirmation.val(); |
| 1227 | var hasAcceptation = $inputAcceptation.val(); | 1249 | var hasAcceptation = $inputAcceptation.val(); |
| 1228 | var hasCaptcha = $inputCaptcha.val().length > 0; | 1250 | var hasCaptcha = $inputCaptcha.val().length > 0; |
| 1229 | var hasError = (!hasEmail || !hasUsername || !hasPassword || !hasPasswordConfirmation || !hasPasswordEquals || !hasAcceptation || !hasCaptcha); | 1251 | var hasError = (!hasEmail || !hasUsername || !hasPassword || !hasPasswordConfirmation || !hasPasswordEquals || !hasAcceptation || !hasCaptcha); |
| @@ -1290,11 +1312,13 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | @@ -1290,11 +1312,13 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | ||
| 1290 | } | 1312 | } |
| 1291 | $(document).trigger('login:success', data); | 1313 | $(document).trigger('login:success', data); |
| 1292 | }) | 1314 | }) |
| 1293 | - .fail(function (data, var2) { | ||
| 1294 | - var msg = ""; | 1315 | + .fail(function (data) { |
| 1316 | + var msg = ''; | ||
| 1295 | // Reload captcha here | 1317 | // Reload captcha here |
| 1296 | - if(window.lastCaptcha) | 1318 | + if(window.lastCaptcha){ |
| 1297 | window.lastCaptcha.recarregar(); | 1319 | window.lastCaptcha.recarregar(); |
| 1320 | + } | ||
| 1321 | + | ||
| 1298 | if(data.responseJSON){ | 1322 | if(data.responseJSON){ |
| 1299 | try{ | 1323 | try{ |
| 1300 | msg = Main.responseToText(data.responseJSON.message); | 1324 | msg = Main.responseToText(data.responseJSON.message); |
| @@ -1325,32 +1349,7 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | @@ -1325,32 +1349,7 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | ||
| 1325 | } | 1349 | } |
| 1326 | }); | 1350 | }); |
| 1327 | 1351 | ||
| 1328 | - // var popupCenter = function(url, title, w, h) { | ||
| 1329 | - // var dualScreenLeft = window.screenLeft !== undefined ? window.screenLeft : screen.left; | ||
| 1330 | - // var dualScreenTop = window.screenTop !== undefined ? window.screenTop : screen.top; | ||
| 1331 | - | ||
| 1332 | - // var width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width; | ||
| 1333 | - // var height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height; | ||
| 1334 | - | ||
| 1335 | - // var left = ((width / 2) - (w / 2)) + dualScreenLeft; | ||
| 1336 | - // var top = ((height / 3) - (h / 3)) + dualScreenTop; | ||
| 1337 | - | ||
| 1338 | - // var newWindow = window.open(url, title, 'scrollbars=yes, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left); | ||
| 1339 | - | ||
| 1340 | - // // Puts focus on the newWindow | ||
| 1341 | - // if (window.focus) { | ||
| 1342 | - // newWindow.focus(); | ||
| 1343 | - // } | ||
| 1344 | - // }; | ||
| 1345 | - | ||
| 1346 | - // $(document).on('click', '.social a.popup', {}, function popUp(e) { | ||
| 1347 | - // var self = $(this); | ||
| 1348 | - // popupCenter(self.attr('href'), self.find('.rrssb-text').html(), 580, 470); | ||
| 1349 | - // e.preventDefault(); | ||
| 1350 | - // }); | ||
| 1351 | - | ||
| 1352 | $(document).on('click', '#logout-button', function (e){ | 1352 | $(document).on('click', '#logout-button', function (e){ |
| 1353 | - var self = $(this); | ||
| 1354 | $.removeCookie('_dialoga_session'); | 1353 | $.removeCookie('_dialoga_session'); |
| 1355 | $.removeCookie('votedProposals'); | 1354 | $.removeCookie('votedProposals'); |
| 1356 | $.removeCookie('*'); | 1355 | $.removeCookie('*'); |
| @@ -1365,36 +1364,36 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | @@ -1365,36 +1364,36 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | ||
| 1365 | }); | 1364 | }); |
| 1366 | 1365 | ||
| 1367 | // hack-fix to support z-index over video/iframe | 1366 | // hack-fix to support z-index over video/iframe |
| 1368 | - function checkIframes () { | ||
| 1369 | - | ||
| 1370 | - $('iframe').each(function(){ | ||
| 1371 | - var $iframe = $(this); | ||
| 1372 | - var url = $iframe.attr('src'); | ||
| 1373 | - var c = '?'; | ||
| 1374 | - | ||
| 1375 | - if(url.indexOf("youtube") === -1){ | ||
| 1376 | - // is not a iframe of youtube | ||
| 1377 | - // console.debug('is not a iframe of youtube'); | ||
| 1378 | - return; | ||
| 1379 | - } | ||
| 1380 | - | ||
| 1381 | - if(url.indexOf("wmode=opaque") !== -1){ | ||
| 1382 | - // already in opaque mode | ||
| 1383 | - // console.debug('already in opaque mode'); | ||
| 1384 | - return; | ||
| 1385 | - } | ||
| 1386 | - | ||
| 1387 | - if(url.indexOf('?') !== -1){ | ||
| 1388 | - c = '&'; | ||
| 1389 | - } | 1367 | + // function checkIframes () { |
| 1368 | + | ||
| 1369 | + // $('iframe').each(function(){ | ||
| 1370 | + // var $iframe = $(this); | ||
| 1371 | + // var url = $iframe.attr('src'); | ||
| 1372 | + // var c = '?'; | ||
| 1373 | + | ||
| 1374 | + // if(url.indexOf("youtube") === -1){ | ||
| 1375 | + // // is not a iframe of youtube | ||
| 1376 | + // // console.debug('is not a iframe of youtube'); | ||
| 1377 | + // return; | ||
| 1378 | + // } | ||
| 1379 | + | ||
| 1380 | + // if(url.indexOf("wmode=opaque") !== -1){ | ||
| 1381 | + // // already in opaque mode | ||
| 1382 | + // // console.debug('already in opaque mode'); | ||
| 1383 | + // return; | ||
| 1384 | + // } | ||
| 1385 | + | ||
| 1386 | + // if(url.indexOf('?') !== -1){ | ||
| 1387 | + // c = '&'; | ||
| 1388 | + // } | ||
| 1390 | 1389 | ||
| 1391 | - $iframe.attr("src",url+c+"wmode=opaque"); | ||
| 1392 | - // console.debug('iframe changed to opaque mode'); | ||
| 1393 | - }); | 1390 | + // $iframe.attr("src",url+c+"wmode=opaque"); |
| 1391 | + // // console.debug('iframe changed to opaque mode'); | ||
| 1392 | + // }); | ||
| 1394 | 1393 | ||
| 1395 | - setTimeout(checkIframes, 500); | ||
| 1396 | - } | ||
| 1397 | - checkIframes(); | 1394 | + // setTimeout(checkIframes, 500); |
| 1395 | + // } | ||
| 1396 | + // checkIframes(); | ||
| 1398 | 1397 | ||
| 1399 | }); | 1398 | }); |
| 1400 | 1399 | ||
| @@ -1406,11 +1405,11 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | @@ -1406,11 +1405,11 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | ||
| 1406 | }); | 1405 | }); |
| 1407 | 1406 | ||
| 1408 | if('onhashchange' in window){ | 1407 | if('onhashchange' in window){ |
| 1409 | - window.onhashchange = function(){ | 1408 | + window.onhashchange = function(){ |
| 1410 | Main.locationHashChanged.apply(Main); | 1409 | Main.locationHashChanged.apply(Main); |
| 1411 | - } | 1410 | + }; |
| 1412 | }else{ | 1411 | }else{ |
| 1413 | - // console.log('The browser not supports the hashchange event!'); | 1412 | + console.warn('The browser not supports the hashchange event!'); |
| 1414 | } | 1413 | } |
| 1415 | 1414 | ||
| 1416 | // Handle resize event | 1415 | // Handle resize event |
| @@ -1439,7 +1438,7 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | @@ -1439,7 +1438,7 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun | ||
| 1439 | 1438 | ||
| 1440 | timeout = setTimeout(delayed, threshold || 100); | 1439 | timeout = setTimeout(delayed, threshold || 100); |
| 1441 | }; | 1440 | }; |
| 1442 | - } | 1441 | + }; |
| 1443 | 1442 | ||
| 1444 | // smartresize | 1443 | // smartresize |
| 1445 | jQuery.fn[sr] = function(fn){ | 1444 | jQuery.fn[sr] = function(fn){ |