I want to add the following javascript code into the footer of Opencart (2.0.3) to integrate notifyvisitors app for my website.
But I don't know how and where to add javascript code to enable notifyvisitors app.
<div id='notifyvisitorstag'></div>
<script>
var notify_visitors = window.notify_visitors || {};
(function() {
notify_visitors.auth = { bid_e : '7E8xxxxxxxxxxxx561', bid : '0000`enter code here`', t : '420'};
var script = document.createElement('script');script.async = true;
script.src = (document.location.protocol == 'https:' ? "//d2933uxo1uhve4.cloudfront.net" : "//cdn.notifyvisitors.com") + '/js/notify-visitors-1.0.js';
var entry = document.getElementsByTagName('script')[0];
entry.parentNode.insertBefore(script, entry);
})();
</script>
Please guide.
Thanks.
Notifyvisitors updated plugin is now available at official opencart extension store.
Related
I am having a task to integrate clevertap with vuejs frontend. but clevertap is undefined, how can i declare clevertap in vuejs?
clevertap.event.push("Product Viewed", {
"Product name":"Casio Chronograph Watch",
"Category":"Mens Accessories",
"Price":59.99,
});
You could either import https://github.com/CleverTap/clevertap-web-sdk into your project which will give you the clevertap object or alternatively add the following script to your app's HTML
<script type="text/javascript">
var clevertap = {event:[], profile:[], account:[], onUserLogin:[], notifications:[], privacy:[]};
// replace with the CLEVERTAP_ACCOUNT_ID with the actual ACCOUNT ID value from your Dashboard -> Settings page
clevertap.account.push({"id": "CLEVERTAP_ACCOUNT_ID"});
clevertap.privacy.push({optOut: false}); //set the flag to true, if the user of the device opts out of sharing their data
clevertap.privacy.push({useIP: false}); //set the flag to true, if the user agrees to share their IP data
(function () {
var wzrk = document.createElement('script');
wzrk.type = 'text/javascript';
wzrk.async = true;
wzrk.src = ('https:' == document.location.protocol ? 'https://d2r1yp2w7bby2u.cloudfront.net' : 'http://static.clevertap.com') + '/js/a.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(wzrk, s);
})();
</script>
Source: https://developer.clevertap.com/docs/web-quickstart-guide
This will create a clevertap object globally and you can use window.clevertap within your vue app.
I'm trying to integrate Disqus on my test Magento website. I'm using NeoTheme Blog Extension however I disabled the built in comment section and change it to disqus.
The problem was the canonical url. I have a main category http://?????.com/news-and-media/ that has a sub category /blog and /news and others. The blog page can be access as http://????/.com/news-and-media/blog-content and http://????/.com/news-and-media/blog/blog-content, both display the same content. I tried to comment on each url however the comment is missing from the other page and vice versa.
This is my progress so far.
My phtml
<div id="disqus_thread"></div>
<script>
var disqus_config = function () {
this.page.url = 'http://?????.com/news-and-media/';
this.page.identifier = 'blog';
};
(function() { // DON'T EDIT BELOW THIS LINE
var d = document, s = d.createElement('script');
s.src = 'https://????-com.disqus.com/embed.js';
s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
})();
</script>
<noscript>Please enable JavaScript to view the comments powered by Disqus.</noscript>
My local.xml
<neotheme_blog_post_index>
<reference name="disquscomment">
<block type="core/template" name="dcomment" template="disqus-comments.phtml" />
</reference>
</neotheme_blog_post_index>
Do you have solution for this canonical? I can't seemed to undesrtand the documentation and example.
https://help.disqus.com/customer/portal/articles/472098-javascript-configuration-variables
How to make Disqus to work with url routing?
You have to fetch the rel canonical value using javascript and use it as your page identifier. I'm not sure if this works.
var canonical = "";
var links = document.getElementsByTagName("link");
for (var i = 0; i < links.length; i ++) {
if (links[i].getAttribute("rel") === "canonical") {
canonical = links[i].getAttribute("href")
}
}
var disqus_config = function () {
this.page.url = '';
this.page.identifier = canonical;
};
(function() { // DON'T EDIT BELOW THIS LINE
Check this link for reference. http://javascript.qahowto.com/Obtaining-canonical-url-using-JavaScript-javascript-url-5b420a
In my webscraper some of the content is coming with advertisements and some java script functions in it. Like the below;
(function() { var infAds = document.createElement('script'); infAds.async = true; infAds.type = 'text/javascript'; var useSSL = 'https:' == document.location.protocol; infAds.src = (useSSL ? 'https:' : 'http:') + '//d.infeed.id/widget-50716010/loader/all/'; var node = document.getElementById('cont-50716010-all'); node.parentNode.insertBefore(infAds, node); })();
I have used lxml.html.clean.Cleaner to remove the scripts and styles from the content. But it is not all removing what i expected. I tried like the below;
from lxml.html.clean import Cleaner
cleaner = Cleaner()
cleaner.javascript = True
cleaner.scripts = True
content = "Page content"
clean_content = cleaner.clean_html(content)
print(clean_content)
But if i use
__clean_content = lxml.html.toString(cleaner.clean_html(content))
__
i am getting the below type error;
TypeError: Type 'str' cannot be serialized.
Using regex also i have tried, it wasn't worked out too. Any suggestions or help would be greatly appreciable!
Thanks in advance.
How can i convert this HTML code into Action script code, i am an android and actionscript developer, i dont know much about HTML and java script. i have tried different forums, i know it can be converted, can someone help me
<script type="text/javascript">
adroll_adv_id = "JD5ZGBNO4RBYVAMMMPX3J7";
adroll_pix_id = "CEJOJM5N5VAHBKCVMT2DML";
(function () {
var oldonload = window.onload;
window.onload = function(){
__adroll_loaded=true;
var scr = document.createElement("script");
var host = (("https:" == document.location.protocol) ? "https://s.adroll.com" : "http://a.adroll.com");
scr.setAttribute('async', 'true');
scr.type = "text/javascript";
scr.src = host + "/j/roundtrip.js";
((document.getElementsByTagName('head') || [null])[0] ||
document.getElementsByTagName('script')[0].parentNode).appendChild(scr);
if(oldonload){oldonload()}};
}());
</script>
Well the code you listed is actually javascript encased in a html tag. Javascript and actionscript are pretty similar, you should be able to use the same code with minimal changes. Just use the javascript as a reference to code it with actionscript
I have a Google Custom Search (that will be a Site Search in the future) and I'd like to use the snippet that Google provides:
<script>
(function() {
var cx = '...';
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>
I need to restrict it to certain urls. When using the xml api, you can use the parameter as_sitesearch to specify this filter.. is there a way to do this with the code above?
with this I can now access the google.search.cse object before the search is loaded.. but I still don't know parameter:
<script>
var myCallback = function() {
if (document.readyState == 'complete') {
// Document is ready when CSE element is initialized.
// Render an element with both search box and search results in div with id 'test'.
google.search.cse.element.render(
{
div: "test",
tag: 'search'
});
} else {
// Document is not ready yet, when CSE element is initialized.
google.setOnLoadCallback(function() {
// Render an element with both search box and search results in div with id 'test'.
google.search.cse.element.render(
{
div: "test",
tag: 'search'
});
}, true);
}
};
// Insert it before the CSE code snippet so that cse.js can take the script
// parameters, like parsetags, callbacks.
window.__gcse = {
parsetags: 'explicit',
callback: myCallback
};
(function() {
var cx = '007407192365638902354:eyxoavi7oa0';
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>
<style>
.gsc-control-cse * {
box-sizing:content-box;
}
</style>
Yes you can.
Use a hidden field inside your search form:
<input type="hidden" name="as_sitesearch" value="your_url_here/directory">
I've got the same question. The only way I have been able to restrict the search to a particular folder in Google Site Search version 2 is to hard-code it into the element:
<gcse:search as_sitesearch="www.mydomain.com/site1"></gcse:search>
It would be great if there was a way to add as_sitesearch via JavaScript, like with version 1.
To restrict to certain urls:
<gcse:searchbox-only as_sitesearch="mydomain.com" resultsUrl="http://mydomain.com/search-results/" enableAutoComplete="false"></gcse:searchbox-only>
Be sure to replace mydomain.com with the appropriate domain that you want to restrict to.