Localizing the sign-in button - authentication

hallo following this tutorial
https://developers.google.com/+/web/signin/#customizing_the_sign-in_button
when i implement the localization script to show the button in korean, german or whatever the g+ button dissapear
<script type="text/javascript">
// Specify the language code prior to loading the JavaScript API
window.___gcfg = {
lang: 'ko'
}
(function() {
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
po.src = 'https://apis.google.com/js/client:plusone.js?onload=onLoadCallback';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();
</script>
Maybe im doing something wrong but the code looks so easy...
thank you for your time and sorry for my english.

You're in luck, Ian Barber just wrote a blog post about localizing Google+:
http://www.riskcompletefailure.com/2013/08/google-sign-in-localisation.html
That should answer your question.

The issue in the code is that you are missing a semicolon after the global window config markup:
<script type="text/javascript">
// Specify the language code prior to loading the JavaScript API
window.___gcfg = {
lang: 'ko'
};
(function() {
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
po.src = 'https://apis.google.com/js/client:plusone.js?onload=onLoadCallback';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();
Should work.

Related

How to use Discourse comments in VueJS?

I have a website that uses Vuejs. And a forum in Discourse. I am trying to insert a javascript in the template file that will connect comments from the forum to a specific page on Vuejs site. But I get the error:
Templates should only be responsible for mapping the state to the UI.
Avoid placing tags with side-effects in your templates, such as <script>,
as they will not be parsed.
My Detail.vue code:
<div id='discourse-comments'></div>
<script type="text/javascript">
DiscourseEmbed = { discourseUrl: 'https://forum.epicseven.ru/',
discourseEmbedUrl: '{{url absolute="true"}}' };
(function() {
var d = document.createElement('script'); d.type = 'text/javascript';
d.async = true;
d.src = DiscourseEmbed.discourseUrl + 'javascripts/embed.js';
(document.getElementsByTagName('head')[0] ||
document.getElementsByTagName('body')[0]).appendChild(d);
})();
</script>
I was try change text/javascript to application/javascript, but when i try render it, i receive error:
- invalid expression: missing ) after argument list in
" \n DiscourseEmbed = { discourseUrl: 'https://forum.epicseven.ru/',\n
discourseEmbedUrl: '"+_s(url absolute="true")+"' };\n\n (function() {\n
var d = document.createElement('script'); d.type =
'application/javascript'; d.async = true;\n d.src =
DiscourseEmbed.discourseUrl + 'javascripts/embed.js';\n
(document.getElementsByTagName('head')[0] ||
document.getElementsByTagName('body')[0]).appendChild(d);\n })();\n"
Raw expression: DiscourseEmbed = { discourseUrl:
'https://forum.epicseven.ru/',
discourseEmbedUrl: '{{url absolute="true"}}' };
(function() {
var d = document.createElement('script'); d.type =
'application/javascript'; d.async = true;
d.src = DiscourseEmbed.discourseUrl + 'javascripts/embed.js';
(document.getElementsByTagName('head')[0] ||
document.getElementsByTagName('body')[0]).appendChild(d);
})();
How i can fix this error? Maybe try to use different part of code?

Exclude FTP results from Google custom Search

I did get my code to implement google custom search which is below:
<script>
(function() {
var cx = '007573243353096205708:4ydbnopnt9s';
var gcse = document.createElement('script');
gcse.type = 'text/javascript';
gcse.async = true;
gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
'//www.google.com/cse/cse.js?cx=' + cx;
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(gcse, s);
})();
</script>
<gcse:search></gcse:search>
But this code and my public url shows me FTP results.
When I try to exclude ftp results like ftp://www.mysite.com/*
it excludes all results.
What should I do so that my search excludes FTP results.
I saw this link but could not understand where to put the code suggested
https://productforums.google.com/forum/#!searchin/customsearch/ftp%7Csort:relevance/customsearch/CitHAOTAgS4/W79di_lOuS8J
Any help is appreciated.

Google custom search engine with bootstrap design

I would like to ask how I can combine Google CSE with Bootstrap. I found some answers on the internet but how i guess it is not actual. Because the code which I get from google looks really differently.
What I get from google:
<script>
(function() {
var cx = '001723502654893543491:ljrinx1fco0';
var gcse = document.createElement('script');
gcse.type = 'text/javascript';
gcse.async = true;
gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
'//www.google.com/cse/cse.js?cx=' + cx;
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(gcse, s);
})();
</script>
<gcse:search></gcse:search>
So, what I need to do is turn off the default design which is define ... uhm... I have no idea where. And set (somehow) classes of objects (textbox, button, search results ,... ) on classes from bootstrap css.

Google AdWord Example to haml

Given this example: https://support.google.com/adwords/answer/3207306?hl=en&rd=1
How would I convert the code listed under the "Troubleshooting your code snippet" section to haml?
The closest I've come is:
%script{:type=>"text/javascript"}
:cdata
var google_conversion_id = 123456789;
var google_conversion_language = "en";
var google_conversion_format = "3";
var google_conversion_color = "ffffff";
var google_conversion_label = "AAAAAAAAAAAAAAAAAAA";
var google_conversion_value = 0;
var google_remarketing_only = false;
%script{:type => "text/javascript", :src => "//www.googleadservices.com/pagead/conversion.js"}
%noscript
%div{:style => "display:inline;"}
%img{:height => "1", :width => "1", :style => "border-style:none;", :alt => "", :src => "//www.googleadservices.com/pagead/conversion/123456789/?value=0&label= AAAAAAAAAAAAAAAAAAA&guid=ON&script=0".html_safe}
The problem with above is the :cdata tag produces:
<script type="text/javascript">
<![CDATA[
var google_conversion_id = 123456789;
var google_conversion_language = "en";
var google_conversion_format = "3";
var google_conversion_color = "ffffff";
var google_conversion_label = "AAAAAAAAAAAAAAAAAAA";
var google_conversion_value = 0;
var google_remarketing_only = false;
]]>
</script>
And not:
<script type="text/javascript">
/* <![CDATA[ */
var google_conversion_id = 123456789;
var google_conversion_language = "en";
var google_conversion_format = "2";
var google_conversion_color = "ffffff";
var google_conversion_label = "AAAAAAAAAAAAAAAAAAA";
var google_conversion_value = 0;
/* ]]> */
</script>
Is there a way to explicitly declare the CDATA tag? Or is Google not that picky about it?
You can escape / in haml with a \ at the beginning of the line. I had the same issue and the following worked for me to include the google adwords conversion tracking code in our site:
<script type="text/javascript">
\/* <![CDATA[ */
var google_conversion_id = 123456789;
var google_conversion_language = "en";
var google_conversion_format = "2";
var google_conversion_color = "ffffff";
var google_conversion_label = "AAAAAAAAAAAAAAAAAAA";
var google_conversion_value = 0;
\/* ]]> */
</script>
which after haml processing turns into:
<script type="text/javascript">
/* <![CDATA[ */
var google_conversion_id = 123456789;
var google_conversion_language = "en";
var google_conversion_format = "2";
var google_conversion_color = "ffffff";
var google_conversion_label = "AAAAAAAAAAAAAAAAAAA";
var google_conversion_value = 0;
/* ]]> */
</script>
After haggling with many variations of the above, I finally "cheated" and just used the :plain tag to get it exactly the way I wanted. The code below exactly replicates what was on the Google Analytics example page, and the Google Tag Assistant plugin for Chrome confirms that it's coming through properly. Note: I also had to change the googleadservices link to HTTPS so that it would match the rest of my page (that was causing other problems that were hard to chase down, and Tag Assistant helped to sort it out).
This should do it for you:
%script{:type=>"text/javascript"}
:plain
/* <![CDATA[ */
var google_conversion_id = 123456789;
var google_conversion_language = "en";
var google_conversion_format = "3";
var google_conversion_color = "ffffff";
var google_conversion_label = "AAAAAAAAAAAAAAAAAAA";
var google_conversion_value = 0;
var google_remarketing_only = false;
/* ]]> */
%script{:type => "text/javascript", :src => "https://www.googleadservices.com/pagead/conversion.js"}
The CDATA tag isn’t really needed in HTML. The intention is that it allows the use of things like literal < in the javascript without having to escape them. CDATA sections are sometimes used with XHTML, but even then XHTML is usually treated as HTML by the browser.
With Haml, you could use the :javascript filter for blocks like this. That will add the CDATA section if your document format is XHTML, and leave it out otherwise. It will also omit the type attribute if the format is HTML5, since the default is text/javascript in that case.
So:
:javascript
var google_conversion_id = 123456789;
// etc ...
Will produce this when the format is HTML5 (the default)
<script>
var google_conversion_id = 123456789;
// etc ...
</script>
and this when the format is XHTML:
<script type='text/javascript'>
//<![CDATA[
var google_conversion_id = 123456789;
// etc ...
//]]>
</script>
Note that this uses // comments for the CDATA markers rather than /* ... */ that the Google page suggests, but this shouldn’t matter.

janrain Social media login integration

Am trying to use janrain social media login , but still i dont understand what i should do and how do i add the user infromation to my table and open his session , now i configered the widget and everything and i got the code as following :
<script type="text/javascript">
(function() {
if (typeof window.janrain !== 'object') window.janrain = {};
if (typeof window.janrain.settings !== 'object') window.janrain.settings = {};
janrain.settings.tokenUrl = '__REPLACE_WITH_YOUR_TOKEN_URL__';
function isReady() { janrain.ready = true; };
if (document.addEventListener) {
document.addEventListener("DOMContentLoaded", isReady, false);
} else {
window.attachEvent('onload', isReady);
}
var e = document.createElement('script');
e.type = 'text/javascript';
e.id = 'janrainAuthWidget';
if (document.location.protocol === 'https:') {
e.src = 'https://rpxnow.com/js/lib/coacharabia/engage.js';
} else {
e.src = 'http://widget-cdn.rpxnow.com/js/lib/coacharabia/engage.js';
}
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(e, s);
})();
</script>
and then the embed div :
<div id="janrainEngageEmbed"></div>
Now Whats next am lost ??
There are two choices. The first is to develop your own token URL in your server-side coding language of choice and write some functionality which would authenticate your user to your system. You would then update the janrain.settings.tokenUrl value with the path to that token URL.
janrain.settings.tokenUrl = 'REPLACE_WITH_YOUR_TOKEN_URL';
The second choice which will be easier is to use a Janrain Engage plugin or widget written for your content management system or framework, which would handle most of the implementation for you. It looks like you are using web2py, which should have Janrain Engage (it's referred to by its old name, RPX) support already built in. Look through your documentation for more info.