Google custom search engine with bootstrap design - google-custom-search

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.

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?

Custom search engine for Google not working

I am trying to integrate custom search engine of google but to no avail. Every time it returns 'No Result' for every data passed.
Code:
<script>
(function() {
var cx = '009439376788807650262:rd6prt0twra';
var gcse = document.createElement('script');
gcse.type = 'text/javascript';
gcse.async = true;
gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
'//cse.google.com/cse.js?cx=' + cx;
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(gcse, s);
})();
</script>
<div>
<gcse:search resultsUrl="http://amniltech.com.np/investment/" newWindow="true" queryParameterName="search">
</gcse:search>
</div>
Can anyone help me here? What am I doing wrong? I am using fuelphp.
<script>
(function() {
var cx = 'Your_Cx_iD';
var gcse = document.createElement('script');
gcse.type = 'text/javascript';
gcse.async = true;
gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
'//cse.google.com/cse.js?cx=' + cx;
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(gcse, s);
})();
</script>
<gcse:search resultsUrl="http://www.amniltech.com.np/investment/" newWindow="true" queryParameterName="search">
This will work.

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.

Localizing the sign-in button

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.

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.