What does this mean in jquery autocomplete? :
$( "#tags" ).autocomplete({
source: availableTags
});
I understand that the autocomplete choices show up in the tags div.
I am trying to apply a salesforce visualforce generated id to this script.
So in salesforce, the id is auto generated. So If I say the id = 'tags', in salesforce it becomes j0_jd1:j2_jd3:tags.
Has anyone overcome using autocomplete with visualforce ids?
Try this:
$('[id$=tags]').autocomplete({
source: availableTags
});
Related
Im an intern and has been granted the privilige of setting up connversion tracking, so we can track who that has been signing up to our newsletter after they clicked one of our LinkedIn Ads. But i have some trouble making it work.
So far, we have integrated the LinkedIn insight Tag in the footer of the website, so it will be able to track conversions. The Insight tag source status is Active, so that’s all good.
Furthermore, we have set up the conversions we want to track and used the ‘Event-Specific’ method. To track when someone is submitting a form, in this case our newsletter sign-up form, I’ve pasted the code below to the header of our website. Then it should be triggered when someone submits the form. The var id is the campaign id for the newsletter signup in Sleeknote. "Your code here" == LinkedIn event-specific snippet
<script type='text/javascript'>
document.addEventListener('sleekNote', function (e) {
var id = 'INSERT CAMPAIGN ID HERE';
if (e.data.type == 'submit' && e.data.campaignId == id)
{
"Your code here"
}
}, false);
</script>
I used this documentation: https://help.sleeknote.com/hc/en-us/articles/7005018805661-What-is-EventEmitter-
Does anyone have a suggestion of how i can make it work?
Thanks in advance!
I've tried reaching out to Sleeknote and LinkedIn
Is it possible to connect to the SeatGeek API to display local event data on a Squarespace site?
The Squarespace API docs all seem directed towards commerce-related goals.
I am familiar with how to connect to the SeatGeek API in the context of a mobile application. But I don't know whether connecting to APIs (other than those listed for commerce) from within a Squarespace is doable.
SeatGeek would be an unofficial integration . I've posted on the squarespace forums with no response, so asking here to see if anyone out there knows about it.
Thanks very much for any help!
Squarespace websites above the "Personal" plan tier support the addition of custom JavaScript via Code Blocks and Code Injection.
Therefore, if SeatGeek supports using their API via JavaScript (and it appears that they do), then you can obtain the data from within your Squarespace website.
Where within your site the code is added and what initialization methods are used will vary on a case-by-case basis. For example, factors include: whether you are using Squarespace 7.0 or 7.1 and whether the template you're using supports AJAX Loading and has it enabled.
However, regardless of where the code is added and the initialization methods used, it looks to me, based on what I see here, that obtaining data from SeatGeek via JavaScript is possible. (Select "JavaScript > XMLHttpRequest" or "JavaScript > Fetch" from the upper-right "Code Snippet" panel where it says "(Node.js) Unirest" by default):
var data = null;
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open("GET", "https://seatgeek-seatgeekcom.p.rapidapi.com/events");
xhr.setRequestHeader("x-rapidapi-host", "seatgeek-seatgeekcom.p.rapidapi.com");
xhr.setRequestHeader("x-rapidapi-key", "SIGN-UP-FOR-KEY");
xhr.send(data);
Or, via fetch:
fetch("https://seatgeek-seatgeekcom.p.rapidapi.com/events", {
"method": "GET",
"headers": {
"x-rapidapi-host": "seatgeek-seatgeekcom.p.rapidapi.com",
"x-rapidapi-key": "SIGN-UP-FOR-KEY"
}
})
.then(response => {
console.log(response);
})
.catch(err => {
console.log(err);
});
While it varies on a case-by-case basis, in most cases you'll want to use the sitewide code injection area vs. code blocks or page-level code injection. Then, on Squarespace 7.0 sites, you'll want to wrap your code in:
window.Squarespace.onInitialize(Y, function() {
// do stuff here
});
For Squarespace 7.1 sites on the other hand, one would usually wrap the code in:
document.addEventListener('DOMContentLoaded', function() {
// do stuff here
}, false);
Finally, you'll need to think about how you're outputting the data. You could either add HTML markup via a Code Block in the body of the target page, or add the markup to the page as part of your JavaScript.
I'm thinking of a way to implement share email function using gigya, and my website has very specific need for share bar(own template and css, animation, etc), so using buttonImages as below can not resolve my problem.
var params ={
userAction:ua,
shareButtons:'share,facebook,twitter,email', // list of providers
containerID: 'divButtons',
buttonImages:{buttonLeftImgUp:'Button_Left.png',buttonCenterBGImgUp:'Button_Middle.png',buttonRightImgUp:'Button_Right.png'}
};
I've successfully used another supported API, gigya.socialize.postBookmark(params), to implement this.
var params =
{
url: "http://www.gigya.com/",
provider:'tumblr',
facebookDialogType: 'share',
title: "Gigya"
};
gigya.socialize.postBookmark(params);
Unfortunately, this function does not support email as a provider, which means I can not add email into my own share bar. Does anyone know how to implement email share, while using my own template(not using customized image)?
Thanks a lot!
I am one of the engineers at Gigya. So that you can better understand what is happening under the hood, clicking on the email share button from the share bar UI ultimately boils down to a call that looks like this:
document.location.href = "mailto:?to=&subject=" + "Your email subject" + "&body=" + "The body of the email";
So really you can just write your own event handler to call a document.location.href like mentioned above with your own subject and body. Alternatively, you can just set the href of an tag to something equivalent.
Hope that helps,
-CodeMonkeyG
Our company wants to include a LinkedIn Share Button in the news section of our website. It is relatively simple and consists of a carousel that open up the news items individually in Colorbox windows. We want the LinkedIn button to be within the Colorbox windows so that we can share the details of each news item.
So, I have successfully got the hashchange event to work when Colorbox is activated in order to show the correct url for each news item and the LinkedIn button does return the correct url when the news item is shared, however Colorbox doesn't open, it simply links to the index page of our site. My question is how do I fire up Colorbox from this shared link?
I have researched a lot of similar questions but cannot seem to get it working. Any help would be much appreciated. Thank you.
Below is my js and also a jsfiddle: http://jsfiddle.net/stegern/WvfsA/11/
$(document).ready(function()
{
//Carousel for news items
$('#news-carousel').show();
$('#news-carousel').jcarousel({
vertical:true,
scroll:true,
wrap:'circular'
}
);
$('.popup').colorbox({
title: function()
{
var url = $(this).attr('href');
return '#' + url;
},
onOpen:function()
{
window.location.hash = $(this).attr('href');
},
onClosed:function()
{
window.location.hash = "";
},
opacity: 0.7,
transition: 'fade'
}
);
//Attempt to open ColorBox when url is shared
$(function(){
var hash = window.location.hash;
if ('onhashchange' in window)
{
window.onhashchange = hashChanged;
}
else
{
setInterval(function(){
if (window.location.hash != hash)
{
hash = window.location.hash;
hashChanged();
}
}, 500);
}
var hashChanged = function(){
$.colorbox();
}
}
);
});
UPDATE
I have done some more research and discovered that I need to load my content in an iframe rather than using Ajax. I then need to add a querystring to my news item links and parse the parameters from the querystring in order to pass them to ColorBox.
However I am now getting a semantic issue with my js (line 8 Expected ')' token) which I don't know how to resolve. Can someone please explain.
Here is my html markup:
<ul>
<li>News Item One
</li>
<li>News Item Two
</li>
<li>News Item Three
</li>
And here is my js:
function getParameters() {
var
settingsObject = {},
hash,
hashes = location.search.substring(1).split(/&/),
i;
for (i = 0; i & lt; hashes.length; i++) {
hash = hashes[i].split('=');
settingsObject[hash[0]] = hash[1];
}
return settingsObject;
}
$('a.cb').colorbox($.extend({
iframe: true,
width: '800',
height: '600'
}, getParameters()));
I also have a jsfiddle setup at: http://jsfiddle.net/stegern/NtSvg/7/
Try putting some example code in a fiddle at http://jsfiddle.net/ then share here.
You posted your js, but we don't have the markup you're trying to use it on, so post the minimum necessary html code to make your example work in a fiddle.
It will help others visualize your problem much easier and quite possibly get you a solution a lot faster.
Ajax isn't loading because browsers typically disallow cross-origin file access for security reasons.Since the main code is hosted on jsfiddle, it forbids you to load pages from your site via ajax.
A quick workaround, if you're using Chrome, you can start it in a less secure mode, like indicated here: https://superuser.com/questions/593726/is-it-possible-to-run-chrome-with-and-without-web-security-at-the-same-time
I just tested now by opening a command prompt in the folder where chrome.exe is located and ran chrome.exe --user-data-dir="C:/Chrome dev session" --disable-web-security
Then I opened http://jsfiddle.net/WvfsA/12/ , where I stripped down your js to the minimum. You'll see your content is now loaded via ajax by colorbox, however, you're doing something wrong with those paths, because the images can't be found.
I took a look at http://jsfiddle.net/WvfsA/13/ and I'm not sure exactly why you have 2 nested $(function () {}), I saw that in Framework & Extensions, ondomready is already selected, so you don't really need to wrap your main function(s) in anything.
Here's a quick screenshot as proof that it works:
http://i.imgur.com/jAiUW28.png?1
When you were developing, were you running your example through a server? You need to have a local server in order for anything ajax-related to work.
Install XAMPP http://www.apachefriends.org/en/xampp.html if you haven't already?
Edit: or you could develop on Chrome launched with that flag I mentioned, to bypass the need of a local webserver, but it's not a really good idea.
I'm using the Facebook Registration Plugin and it seems to have stopped working, but I'm not sure why. What happens is that instead of loading the registration form, it just displays the moving bars loading icon (and never loads). I have the necessary credentials, also in the past when my credentials were wrong, an error message would appear in the space that the form would normally show.
One thing I noticed was that when I visit the registration's FB page I can see the two examples without custom fields, but I can't see the example with custom fields. In my usage, I use custom fields. Maybe it has something to do with using custom fields and/or firewalls?
So right now, users can't register. Please help! Thank you!
Here's my code:
<div id="fb-root"></div>
<%= javascript_include_tag "https://connect.facebook.net/en_US/all.js#appId=myappnumberiscorrecthere&xfbml=1" %>
<% site_url = MyApplication::Application.config.site_url %>
<fb:registration
fields="[
{'name':'name'},
{'name':'first_name'},
{'name':'last_name'},
{'name':'email'},
{'name':'gender'},
{'name':'birthday'},
{'name':'username', 'description':'User Name', 'type':'text'},
{'name':'postal_code', 'description':'Postal Code', 'type':'text'},
{'name':'password'},
{'name':'captcha'}
]"
redirect-uri="https://<%= #domain + "." + site_url %>/users"
width="530">
</fb:registration>
</div>
Remove the captcha field.
I'm experiencing the same problem when trying to load their documentation page with custom fields and when using the code you have provided.
By removing the captcha, it seems to work. I presume there is a bug on Facebook's end.
You can track the bug here:
http://developers.facebook.com/bugs/509265599090288?browse=search_5028d48a2f1678298252951
change it from
fields="[
{'name':'name'},
{'name':'first_name'},
{'name':'last_name'},
{'name':'email'},
{'name':'gender'},
{'name':'birthday'},
{'name':'username', 'description':'User Name', 'type':'text'},
{'name':'postal_code', 'description':'Postal Code', 'type':'text'},
{'name':'password'},
{'name':'captcha'}
]"
to
fields=[
{'name':'name'},
{'name':'first_name'},
{'name':'last_name'},
{'name':'email'},
{'name':'gender'},
{'name':'birthday'},
{'name':'username', 'description':'User Name', 'type':'text'},
{'name':'postal_code', 'description':'Postal Code', 'type':'text'},
{'name':'password'},
{'name':'captcha'}
]"