Commit 4308ae8faafa1548b12604531695f5f453a7f2c6
1 parent
ed3663df
Exists in
master
and in
5 other branches
Add target _blank for social links and log response of facebook
Showing
2 changed files
with
41 additions
and
5 deletions
Show diff stats
index.html
| ... | ... | @@ -474,9 +474,9 @@ |
| 474 | 474 | <script id="social-share" type="text/x-handlebars-template"> |
| 475 | 475 | <ul> |
| 476 | 476 | <li><a href="{{url}}" class="fb-share icon icon-facebook" data-caption="{{title}}" data-description="{{stripTags description}}"><span class="fa fa-facebook"></span><span class="sr-only">Compartilhar no Facebook</span></a></li> |
| 477 | - <li><a href="https://twitter.com/intent/tweet?url={{encodeURI url}}&text={{stripTags description}}" class="tw-share icon icon-twitter popup"><span class="fa fa-twitter"></span><span class="sr-only">Compartilhar no Twitter</span></a></li> | |
| 478 | - <li><a href="https://plus.google.com/share?url={{encodeURI url}}" class="gp-share icon icon-gplus popup"><span class="fa fa-google-plus"></span><span class="sr-only">Compartilhar no Google Plus</span></a></li> | |
| 479 | - <li><a href="whatsapp://send?text={{stripTags description}} {{encodeURI url}}" class="ws-share icon icon-whatsapp"><span class="fa fa-whatsapp"></span><span class="sr-only">Compartilhar no WhatsApp</span></a></li> | |
| 477 | + <li><a href="https://twitter.com/intent/tweet?url={{encodeURI url}}&text={{stripTags description}}" target="_blank" class="tw-share icon icon-twitter popup"><span class="fa fa-twitter"></span><span class="sr-only">Compartilhar no Twitter</span></a></li> | |
| 478 | + <li><a href="https://plus.google.com/share?url={{encodeURI url}}" target="_blank" class="gp-share icon icon-gplus popup"><span class="fa fa-google-plus"></span><span class="sr-only">Compartilhar no Google Plus</span></a></li> | |
| 479 | + <li><a href="whatsapp://send?text={{stripTags description}} {{encodeURI url}}" target="_blank" class="ws-share icon icon-whatsapp"><span class="fa fa-whatsapp"></span><span class="sr-only">Compartilhar no WhatsApp</span></a></li> | |
| 480 | 480 | </ul> |
| 481 | 481 | </script> |
| 482 | 482 | ... | ... |
js/main.js
| ... | ... | @@ -830,6 +830,40 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun |
| 830 | 830 | .done(function( data ) { |
| 831 | 831 | data.host = host; |
| 832 | 832 | data.private_token = Main.private_token; |
| 833 | + | |
| 834 | + // check youtube iframe | |
| 835 | + function forceWmodeIframe(article){ | |
| 836 | + var abstract = article.abstract; | |
| 837 | + // console.log('article.abstract', article.abstract); | |
| 838 | + | |
| 839 | + var patternIframe = '<iframe src="'; | |
| 840 | + var indexOfIframe = abstract.indexOf(patternIframe); | |
| 841 | + | |
| 842 | + if(indexOfIframe === -1){ | |
| 843 | + return; | |
| 844 | + } | |
| 845 | + | |
| 846 | + var startSrcUrl = indexOfIframe + patternIframe.length; | |
| 847 | + var endSrcUrl = abstract.indexOf('"', startSrcUrl); | |
| 848 | + var url = abstract.substring(startSrcUrl , endSrcUrl); | |
| 849 | + // console.log('url', url); | |
| 850 | + | |
| 851 | + if(url.indexOf("wmode=opaque") !== -1){ | |
| 852 | + // already in opaque mode | |
| 853 | + // console.debug('already in opaque mode'); | |
| 854 | + return; | |
| 855 | + } | |
| 856 | + var c = ''; | |
| 857 | + if(url.indexOf('?') !== -1){ | |
| 858 | + c = '&'; | |
| 859 | + } | |
| 860 | + | |
| 861 | + var resultUrl = url+c+"wmode=opaque"; | |
| 862 | + article.abstract = abstract.replace(url, resultUrl); | |
| 863 | + // console.log('article.abstract', article.abstract); | |
| 864 | + }; | |
| 865 | + forceWmodeIframe(data.article); | |
| 866 | + | |
| 833 | 867 | resultsPlaceholder.innerHTML = template(data); |
| 834 | 868 | $('.login-container').html(loginTemplate()); |
| 835 | 869 | $('.countdown').maxlength({text: '%left caracteres restantes'}); |
| ... | ... | @@ -1128,6 +1162,7 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun |
| 1128 | 1162 | }); |
| 1129 | 1163 | |
| 1130 | 1164 | $(document).on('click', '.social .fb-share', function(e) { |
| 1165 | + e.preventDefault(); | |
| 1131 | 1166 | var link = $(this).attr('href'); |
| 1132 | 1167 | FB.ui({ |
| 1133 | 1168 | method: 'feed', |
| ... | ... | @@ -1135,8 +1170,9 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun |
| 1135 | 1170 | name: $(this).data('name') || 'Dialoga Brasil', |
| 1136 | 1171 | caption: $(this).data('caption') || 'dialoga.gov.br', |
| 1137 | 1172 | description: $(this).data('description'), |
| 1138 | - }, function(response){}); | |
| 1139 | - e.preventDefault(); | |
| 1173 | + }, function(response){ | |
| 1174 | + console.log('response', response); | |
| 1175 | + }); | |
| 1140 | 1176 | }); |
| 1141 | 1177 | |
| 1142 | 1178 | $(document).on('click', '.new-user', function(e) { | ... | ... |