Skip to content

Commit

Permalink
Fixed search for twitter api v.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
ManiacTwister committed Nov 28, 2013
1 parent ed2ff01 commit bd1c2cb
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 43 deletions.
7 changes: 0 additions & 7 deletions data/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -904,13 +904,6 @@ <h3 data-i18n-text="api_setting">API Settings</h3>
type="text" class="mochi_entry widget"/>
<label class="label" data-i18n-text="oauth_base"
>OAuth Base</label>
</li><li class="mochi_list_item">
<input id="tbox_prefs_search_api_base2"
title="Search API Base"
type="text" class="mochi_entry widget"/>
<label class="label"
data-i18n-text="search_api_base2"
>Search API Base</label>
</li><li class="mochi_list_item">
<input id="tbox_prefs_upload_api_base"
title="Upload API Base"
Expand Down
3 changes: 0 additions & 3 deletions data/js/conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ default_prefs: {
, 'oauth_base': 'https://api.twitter.com/oauth/'
, 'sign_oauth_base': 'https://api.twitter.com/oauth/'
, 'use_same_sign_oauth_base': true
, 'search_api_base2': 'https://twitter.com/phoenix_search.phoenix'
, 'upload_api_base': 'https://upload.twitter.com/1/'
// extensions and others
, 'exts_enabled': ["org.hotot.imagepreview", "org.hotot.gmap", "org.hotot.translate", "org.hotot.imageupload", "org.hotot.videopreview", "org.hotot.shorturl", "org.hotot.cfw"]
Expand Down Expand Up @@ -126,7 +125,6 @@ default_prefs: {
, 'oauth_base': 'https://identi.ca/api/oauth/'
, 'sign_oauth_base': 'https://identi.ca/api/oauth/'
, 'use_same_sign_oauth_base': true
, 'search_api_base2': 'https://identi.ca/api/'
, 'upload_api_base': 'https://identi.ca/api/'
// extensions:
, 'exts_enabled': ["org.hotot.imagepreview", "org.hotot.gmap", "org.hotot.translate", "org.hotot.imageupload", "org.hotot.videopreview", "org.hotot.shorturl", "org.hotot.cfw"]
Expand Down Expand Up @@ -326,7 +324,6 @@ function apply_prefs(name, full) {
}
})(prefs.api_base);
globals.twitterClient.sign_api_base = prefs.sign_api_base;
globals.twitterClient.search_api_base2 = prefs.search_api_base2;
globals.twitterClient.upload_api_base = prefs.upload_api_base;
globals.twitterClient.use_same_sign_api_base = prefs.use_same_sign_api_base;
var oauth = globals.twitterClient.oauth;
Expand Down
38 changes: 8 additions & 30 deletions data/js/lib.twitter.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ function TwitterClient() {
self.password = '';
self.api_base = 'https://api.twitter.com/';
self.sign_api_base = 'https://api.twitter.com/';
self.search_api_base2 = 'https://twitter.com/phoenix_search.phoenix';
self.upload_api_base = 'https://upload.twitter.com/1/';

self.use_same_sign_api_base = true;
Expand Down Expand Up @@ -764,35 +763,14 @@ function TwitterClient() {
};

self.search = function search(query, page, since_id, max_id, on_success, on_error) {
var url = self.search_api_base2;
if (url == 'https://twitter.com/phoenix_search.phoenix') {
var params = {
'q': query
};
params['format'] = 'phoenix';
params['include_entities'] = 'true';
if (since_id != null) params['since_id'] = since_id;
if (max_id != null) params['max_id'] = max_id;
_page = [];
_page.push('rpp=100');
_page.push('q=' + encodeURI(query));
if (max_id != null) _page.push('max_id=' + max_id);
if (page != null) _page.push('page=' + page);
params['page'] = _page.join('&');
self.source = '';
self.get(url, params, on_success, on_error);
self.source = 'Hotot';
} else {
var params = {
'q': query
};
if (since_id != null) params['since_id'] = since_id;
if (max_id != null) params['max_id'] = max_id;
if (page != null) params['page'] = page;
self.source = '';
self.get(url, params, on_success, on_error);
self.source = 'Hotot';
}
var url = self.api_base + '1.1/search/tweets.json';

var params = {
'q': query
};
if (since_id != null) params['since_id'] = since_id;
if (max_id != null) params['max_id'] = max_id;
self.get(url, params, on_success, on_error);

};

Expand Down
3 changes: 0 additions & 3 deletions data/js/ui.prefs_dlg.js
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,6 @@ function load_prefs() {
.prop('checked', prefs.enable_gpu_acceleration);
$('#tbox_prefs_api_base').val(prefs.api_base);
$('#tbox_prefs_sign_api_base').val(prefs.sign_api_base);
$('#tbox_prefs_search_api_base2').val(prefs.search_api_base2);
$('#tbox_prefs_upload_api_base').val(prefs.upload_api_base);
$('#tbox_prefs_oauth_base').val(prefs.oauth_base);
$('#tbox_prefs_sign_oauth_base').val(prefs.sign_oauth_base);
Expand Down Expand Up @@ -393,8 +392,6 @@ function save_prefs() {
= $('#tbox_prefs_api_base').attr('value');
prefs.sign_api_base
= $('#tbox_prefs_sign_api_base').attr('value');
prefs.search_api_base2
= $('#tbox_prefs_search_api_base2').attr('value');
prefs.upload_api_base
= $('#tbox_prefs_upload_api_base').attr('value');
prefs.oauth_base
Expand Down

0 comments on commit bd1c2cb

Please sign in to comment.