var customer_key = "xxxxxxxxxxxxxxxxxxxxxxxxxxx";
var customer_secret = "xxxxxxxxxxxxxxxxxxxxxxxxx";
var access_token= "xxxxxxxxx";
var access_token_secret = "xxxxxxxxxxx";
var signing_key = customer_secret + "&" + access_token_secret;
var signature_method = "HMAC-SHA1";
var authorization_version = "1.0";
var method = "GET";
var protocol = "https";
var server = "api.twitter.com";
var version = "1.1";
var service = "search/tweets.json";
var BaseURL = protocol + "://" + server + "/" + version + "/" + service;
var callback = "callback=twitterCallback";
var count = "count=" + this.count;
var language = "lang=" + this.lang;
var oauth_consumer_key = "oauth_consumer_key=" + customer_key + "&";
var oauth_nonce = "oauth_nonce=" + this.makeid() + "&";
var oauth_signature_method = "oauth_signature_method=" + signature_method + "&";
var oauth_timestamp = "oauth_timestamp=" + Math.floor(Date.now() / 1000) + "&";
var oauth_token = "oauth_token=" + access_token + "&";
var oauth_version = "oauth_version=" + authorization_version + "&";
var query = "q=" + encodeURIComponent(oEvent.getParameter("query"));
var result_type = "result_type=" + this.resultType;
var oauth_parameters = oauth_consumer_key + oauth_nonce + oauth_signature_method + oauth_timestamp + oauth_token + oauth_version;
var searchOption = query + "&" + count + "&" + result_type;
var parametersString = callback + "&" + count + "&" + language + "&" + oauth_parameters + query + "&" + result_type;
var signatureBaseString = method + "&" + encodeURIComponent(BaseURL) + "&" + encodeURIComponent(parametersString);
jQuery.sap.require("TwitterSearch_v002.util.HMACsha1");
jQuery.sap.require("TwitterSearch_v002.util.EncodeBase64");
jQuery.sap.includeScript("http://crypto-js.googlecode.com/svn/tags/3.1.2/build/components/enc-base64-min.js");
jQuery.sap.includeScript("http://crypto-js.googlecode.com/svn/tags/3.1.2/build/rollups/hmac-sha1.js");
var hash = CryptoJS.HmacSHA1(signatureBaseString, signing_key);
var base64String = hash.toString(CryptoJS.enc.Base64);
var oauth_signature = encodeURIComponent(base64String);
var URL = BaseURL + "?" + searchOption + "&" + oauth_parameters + "oauth_signature=" + oauth_signature + "&" + language + "&" + callback;
var socialGetter = (function() {
/* just a utility to do the script injection */
function addScript(url) {
var script = document.createElement('script');
script.async = true;
script.src = url;
document.body.appendChild(script);
}
return {
getTwitterTweets: function(url) {
addScript(url);
}
};
})();
window.twitterCallback = function(data) {
if (data) {
var twitterResult = new sap.ui.model.json.JSONModel();
twitterResult.setData(data);
sap.ui.getCore().byId("__xmlview0").setModel(twitterResult, "twitterResult");
}
};
sap.ui.getCore().byId("__xmlview0").setModel(twitterResult, "twitterResult")
socialGetter.getTwitterTweets(URL);
<List busyIndicatorDelay="{masterView>/delay}" growing="true" growingScrollToLoad="true" id="list"
items="{ path: 'twitterResult>/statuses', sorter: { path: 'accountID', descending: false }, groupHeaderFactory: '.createGroupHeader' }"
mode="{= ${device>/system/phone} ? 'None' : 'SingleSelectMaster'}" noDataText="{masterView>/noDataText}" selectionChange="onSelectionChange"
updateFinished="onUpdateFinished">
<infoToolbar>
<Toolbar active="true" id="filterBar" press="onOpenViewSettings" visible="{masterView>/isFilterBarVisible}">
<Title id="filterBarLabel" text="{masterView>/filterBarLabel}"/>
</Toolbar>
</infoToolbar>
<items>
<ObjectListItem icon="{twitterResult>user/profile_image_url}"
intro="{twitterResult>user/name} - {twitterResult>created_at} - {twitterResult>user/location}" press="onSelectionChange"
title="{twitterResult>text}" type="{= ${device>/system/phone} ? 'Active' : 'Inactive'}"></ObjectListItem>
</items>
</List>
"statuses": [
{
"metadata": {
"iso_language_code": "en",
"result_type": "recent"
},
"created_at": "Thu Jan 21 14:47:27 +0000 2016",
"id": 690183933741310000,
"id_str": "690183933741309954",
"text": "Throwback Thursday // NYC shoot with elite_e46 for @pbmwmagazine // #meatyflush #bmw #bmwusa… https://t.co/7w1x7293Sf",
"source": "<a href="http://instagram.com" rel="nofollow">Instagram</a>",
"truncated": false,
"in_reply_to_status_id": null,
"in_reply_to_status_id_str": null,
"in_reply_to_user_id": null,
"in_reply_to_user_id_str": null,
"in_reply_to_screen_name": null,
"user": {
"id": 2418867279,
"id_str": "2418867279",
"name": "MeatyFlush",
"screen_name": "MeatyFlush",
"location": "DMV",
"description": "We are a photography collective who's sole purpose is to capture the car scene featuring some of the hottest and greatest automobiles in the DMV.",
"url": "http://t.co/lk0XSiqxNR",
"entities": {
"url": {
"urls": [
{
"url": "http://t.co/lk0XSiqxNR",
"expanded_url": "http://meatyflush.com",
"display_url": "meatyflush.com",
"indices": [
0,
22
]
}
]
},
"description": {
"urls": []
}
},
"protected": false,
"followers_count": 57,
"friends_count": 14,
"listed_count": 14,
"created_at": "Tue Mar 18 01:02:57 +0000 2014",
"favourites_count": 19,
"utc_offset": null,
"time_zone": null,
"geo_enabled": false,
"verified": false,
"statuses_count": 1552,
"lang": "en",
"contributors_enabled": false,
"is_translator": false,
"is_translation_enabled": false,
"profile_background_color": "C0DEED",
"profile_background_image_url": "http://abs.twimg.com/images/themes/theme1/bg.png",
"profile_background_image_url_https": "https://abs.twimg.com/images/themes/theme1/bg.png",
"profile_background_tile": false,
"profile_image_url": "http://pbs.twimg.com/profile_images/519541485772214272/aKA7PMCO_normal.jpeg",
"profile_image_url_https": "https://pbs.twimg.com/profile_images/519541485772214272/aKA7PMCO_normal.jpeg",
"profile_banner_url": "https://pbs.twimg.com/profile_banners/2418867279/1395120295",
"profile_link_color": "0084B4",
"profile_sidebar_border_color": "C0DEED",
"profile_sidebar_fill_color": "DDEEF6",
"profile_text_color": "333333",
"profile_use_background_image": true,
"has_extended_profile": false,
"default_profile": true,
"default_profile_image": false,
"following": false,
"follow_request_sent": false,
"notifications": false
},
"geo": null,
"coordinates": null,
"place": null,
"contributors": null,
"is_quote_status": false,
"retweet_count": 0,
"favorite_count": 0,
"entities": {
"hashtags": [
{
"text": "meatyflush",
"indices": [
70,
81
]
},
{
"text": "bmw",
"indices": [
82,
86
]
},
{
"text": "bmwusa",
"indices": [
87,
94
]
}
],
"symbols": [],
"user_mentions": [
{
"screen_name": "PBMWmagazine",
"name": "PBMW",
"id": 169887768,
"id_str": "169887768",
"indices": [
53,
66
]
}
],
"urls": [
{
"url": "https://t.co/7w1x7293Sf",
"expanded_url": "https://www.instagram.com/p/BAzhLBmPkIE/",
"display_url": "instagram.com/p/BAzhLBmPkIE/",
"indices": [
96,
119
]
}
]
},
"favorited": false,
"retweeted": false,
"possibly_sensitive": false,
"lang": "en"
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
11 | |
9 | |
7 | |
6 | |
4 | |
4 | |
3 | |
3 | |
3 | |
3 |