Skip to content

Instantly share code, notes, and snippets.

@peterk
Last active April 23, 2017 17:49
Show Gist options
  • Save peterk/a533995a475a681aa315 to your computer and use it in GitHub Desktop.
Save peterk/a533995a475a681aa315 to your computer and use it in GitHub Desktop.
Tweaks
Denna rad görs om:
var twitterBtn = '<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>';
till:
var twitterBtn = '';
Hela detta block raderas:
<script type="text/javascript" charset="utf-8">
<!--
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_GB/all.js#xfbml=1&appId=372059436147227";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
//-->
</script>
Dessa rader raderas
getLatestTweet(TwitterName);
getLatestFacebookUpdate(FacebookId, AccessToken);
Hela detta block raderas:
var getLatestTweet = function(name) {
var url = 'http://twitter.com/statuses/user_timeline.json?screen_name=' + name + '&count=1&callback=?';
var twitterIcon = '<img src="' + imgUrl + 'twitter.png" alt="twitter icon" width= "26" height="26" />';
$.getJSON(url, function(data) {
var tweet = data[0].text;
// process links and reply
tweet = tweet.replace(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig, function(url) {
return '<a href="' + url + '">' + url + '</a>';
}).replace(/B@([_a-z0-9]+)/ig, function(reply) {
return reply.charAt(0) + '<a href="http://twitter.com/' + reply.substring(1) + '">'+ reply.substring(1) + '</a>';
});
var text = '<p>' + twitterIcon + tweet + '</p>';
animateStatus('#tweet', text);
});
};
var getLatestFacebookUpdate = function(id, accessToken) {
var url = 'https://graph.facebook.com/'+ id + '/feed?access_token='+ accessToken;
var facebookIcon = '<a href="http://facebook.com/kungligabiblioteket">'+'<img src="' + imgUrl + 'facebook.png" alt="facebook icon" width= "24" height="24" />'+'</a>';
$.ajax({
url: url,
dataType: 'jsonp',
success: function(json) {
var descr = getString(json.data[0].message);
var name= getString(json.data[0].name);
descr = getShortenedText(descr);
if(!json.data[0].link) {
var html = '<p>' + facebookIcon + descr;
}
else {
var html = '<p>' + facebookIcon + descr + '<a href="'+ json.data[0].link + '">' + name + '</a></p>';
}
if(descr){ animateStatus('#facebook', html);
}
}
});
};
Och troligen detta:
<!-- Woopra Code Start -->
<script type="text/javascript">
var _wh = ((document.location.protocol=='https:') ? "https://sec1.woopra.com" : "http://static.woopra.com");
document.write(unescape("%3Cscript src='" + _wh + "/js/woopra.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<!-- Woopra Code End -->
@Zg1985
Copy link

Zg1985 commented Apr 23, 2017

Good job would love to try it out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment