I would like to be able to display on a web page that a twitter user was "last seen" in X location, "where he said" whatever their latest tweet is. This is for a user that has geolocation enabled, and I am doing this to track them on a trip. What is the easiest way to do this? It would look like this:
[user] was last seen in [latest tweet location (city/state, not geopoints)] where he said: [latest tweet]
Any help/advice is appreciated.
UPDATE:
I have tried this adding this to the page:
<script type="text/javascript" src="http://mywebsite.com/blogger.js"></script>
<script type="text/javascript" src="http://twitter.com/statuses/user_timeline/username.json?callback=twitterCallback2&count=1"></script>
<script type="text/javascript" src="http://twitter.com/statuses/user_timeline/username.json?callback=twitterLocation&count=1"></script>
And then modifying twitter's blogger.js to add this at the top:
function twitterLocation(twitters) {
var statusHTML = [];
for (var i=0; i<twitters.length; i++){
var place= twitters[i].place.full_name;
statusHTML.push('+place+');
}
document.getElementById('location').innerHTML = statusHTML.join('');
}
and finally, putting a
<span id="location></span>
and
<div id="twitter_update_list"></div>
in the html as well.
The tweet comes out okay, but the only thing placed in the "location" span is just the text, "+place"
Is it possible that I'm on any sort of right track here?
You should Google for the answer here, but I would simply use the REST API:
https://dev.twitter.com/docs/api/1/get/statuses/user_timeline
The last location would be in the "geo" parameter.
Then use the Google Reverse Geocoding API to pull out a location string:
https://developers.google.com/maps/documentation/geocoding/#ReverseGeocoding
Related
I am working on an Automated Tumblr blog and noticed that you can't post Twitch streams as a video post, however when you embed them you can.
There are going to be multiple users and it will be expanding, so I am trying to automate the script in IFTTT, however, I don't have much scripting knowledge and tried to get this done... didn't work out.
The question:
It all starts with the content link, this can really be any platform. However, all platforms that aren't supported by Tumblr need a different embed.
So what I want is a script (not asking for the script, just help) that can detect what platform the link is from and chooses a path on what it found out.
Basically, a script that checks if it's twitch, run a, if it's youtube run b, etc.
If the input contains "Twitch" run:
<html>
<body>
<div id="twitch-embed"></div>
<script src="https://embed.twitch.tv/embed/v1.js"></script>
<script type="text/javascript">
new Twitch.Embed("twitch-embed", {
width: 854,
height: 480,
channel: "{channel Name}"
});
</script>
</body>
</html>
If YouTube:
<script type="text/html" id="Video URL here">
How do I create these checks?
(I know this question is stupid and probably easy, but I am not really big on scripting)
You can take the URL string and check it against each keyword to determine if it exists:
var urlString = "https://www.twitch.tv/Reco_Mouse";
if(urlString.indexOf("twitch.tv") !== -1) {
//First, dynamically include the Twitch script tag on the page
new Twitch.Embed("twitch-embed", {
width: 854,
height: 480,
channel: "{channel Name}"
});
break;
} else if(urlString.indexOf("youtube.com") !== -1) {
//Apply necessary steps for YouTube videos
} else if(urlString.indexOf("anothervideotype.com") !== -1) {
... //Apply necessary steps for another video type
}
I am looking to try and pull the images from my society6 shop into a PHP page. Currently I am using the following code which is provided by Society 6, which seems to only pull one image.
Can anyone point me in the right direction to pull all the images surrounded by a link with the Javascript or ideally with PHP so I can embed them
<script type="text/javascript"><!--
s6_user = "ThriftandThistle";
s6_format = "300x250";
//--></script>
<script type="text/>
http://society6.com/js/show_banner.js
I'm building a website that uses Google's DoubleClick for Publishers Ad serving system. Since we have targeted ads for multiple sections of the sites, multiple pages, and articles we have over 30 ad units, usually all with the same name, like:
ad_sports_top_banner_300x250
ad_home_skyscraper_720x90
etc.
When I go to DFP systems and ask to generate tags it usually spits out something like this to add to the :
<script type='text/javascript'>
googletag.cmd.push(function() {
googletag.defineSlot('/1234567/ad_home_skyscraper_728x90', [728, 90], 'div-gpt-ad-1234567890123-0').addService(googletag.pubads());
googletag.defineSlot('/1234567/ad_sports_top_banner_300x250', [300, 250], 'div-gpt-ad-1234567890123-1').addService(googletag.pubads());
and something like this to add where I want the add placed:
<div id='div-gpt-ad-1234567890123-0' style='width:728px; height:90px;'>
<script type='text/javascript'>
googletag.cmd.push(function() { googletag.display('div-gpt-ad-1234567890123-0'); });
</script>
</div>
As far as I could tell most things are pretty obvious, the first 7 digit number is my customer id number, followed by the ad name, followed by a 13 digit ad id.
I have a lot of sections, using multiple templates for the body, head etc, so instead of going into each one and having to manually enter a different code on the header and body I would prefer to generate them programatically using onye the Section Name as a variable, like this:
googletag.defineSlot('/1234567/ad_$SectionNameGoesHere_$TypeOfAdGoesHere', [$width, $height], 'div-gpt-ad-1234567890123-0').addService(googletag.pubads());
The only thing that seems to vary from tag to tags in an unpredictable manner is the 13 digit number that seems to be the tag id. Whenever I pick a different set of ads, google gives me a different 13 digit number. I tested on the site and it works if I the same number everytime, but this feels wrong.
Does anyone knows what does that number stands for? Is there a way I can calculate it, or ignore it?
Thanks.
the 13 digit number is strictly a unique ID for each ad. you can have it be whatever you want and does not interfere with your ad code.
Its strictly used to identify the id of the div that is populating the ad on the page.
I.E:
<script type='text/javascript'>
googletag.cmd.push(function() {
googletag.defineSlot('/1234567/ad_home_skyscraper_728x90', [728, 90], 'div-728x90-1').addService(googletag.pubads());
googletag.defineSlot('/1234567/ad_sports_top_banner_300x250', [300, 250], 'div-300x250-1').addService(googletag.pubads());
would need:
<div id='div-728x90-1' style='width:728px; height:90px;'>
<script type='text/javascript'>
googletag.cmd.push(function() { googletag.display('div-728x90-1'); });
</script>
</div>
<div id='div-300x250-1' style='width:300px; height:250px;'>
<script type='text/javascript'>
googletag.cmd.push(function() { googletag.display('div-300x250-1'); });
</script>
</div>
hope this helps.
I have google custom search, by default the search box has got background image, I can remove that image, But not able to replace with my image. so Is there a way to do this.
Adding this to my CSS worked for me:
.cse input.gsc-input, input.gsc-input {background-image:none !important;}
Yes! You can do this!
Please find particular id or css for that and then use CSS according to that id or CSS and make sure you add !important at end it will works for you.
To remove the Google Custom search watermark you need to run a java-query infinite looped code it can't be done by adding a one time running code since every time you will click the search input field he code will rerun from the server side and the watermark will reappear.
the exact code you need to do is listed below but to achieve the desired result you must import Jquery liberary file from link jquery.com download/ and link it to your page
to link it to your page do so.
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
the actual code to hide watermark is.
<script>
$(document).ready(function() {
setInterval( function()
{
$("#gsc-i-id1").css("background-image","none")
},1/*Time*/);
});
</script>
because the ID of the search box is " gsc-i-id1 " so the code will work even if you click and unclick the field.
Please adjust the time of the function to your preference for better performance better keep it less than 100 mile seconds
check the live performance of code by clicking the link below.
http://jsfiddle.net/atulc007/tHQAD/1/
You have to customize GCSE which is given in your code. To explain in detail, you have to select this url in your code - "http://www.google.com/coop/cse/brand?form=cse-search-box&lang=en". Then paste and search this url in your browser. You will get the sorce code of that java script. In that find an image .gif link and replace with your image and save it as .js file and replace the link and upload. Hope you will enjoy :)
I make a simple html page and set it on facebook fan page tab but the tab which shows on fan page is shows a scroll bar buti already set to auto resize and the height of this html page is large i want to hide the scroll bar and show the complete page
The best solution I found, which works for me is:
You need to setup the Facebook app canvas settings, Canvas height to Fluid.

Then, add some javascript in the page header:
<script type="text/javascript" src="https://connect.facebook.net/en_US/all.js"></script>
<script type="text/javascript" charset="utf-8">
FB.Canvas.setAutoResize();
</script>
Finally, force our body and html tag to avoid scroll bars in css.
body, html {
overflow:hidden;
}
This has worked for me to remove all the scroll bars. It's working on the 18th of October 2011, but because Facebook keep changing their code, it may change in the future.
A full article about Facebook iframe is available on my blog: http://gpiot.com/facebook-page-tab-hide-scroll-bars-from-iframe/
Thanks to all of you.
Here is the answer of my question; I posted it here so that if any body find this question in future will also get the answer and his/her time is not wasted. I get the solution by adding the following code just before the </body> tag of my index page
<script type="text/javascript">
window.fbAsyncInit = function() {
FB.Canvas.setSize();
}
// Do things that will sometimes call sizeChangeCallback()
function sizeChangeCallback() {
FB.Canvas.setSize();
}
</script>
Once again, thanks to all.
This solution works for me
http://aarosant.com/2011/03/14/adjust-the-size-of-facebook-iframe-tabs/
GO TO the App Setting -> Advanced setting -> canvas page there you can change width and height to fixed from fluid