Skip to content

Commit

Permalink
Merge remote-tracking branch 'shellex/master'
Browse files Browse the repository at this point in the history
Conflicts:
	data/index.html
  • Loading branch information
marguerite committed Jul 30, 2012
2 parents d9fc96f + 66275bc commit b8644e9
Show file tree
Hide file tree
Showing 13 changed files with 139 additions and 107 deletions.
2 changes: 1 addition & 1 deletion data/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ <h3 data-i18n-text="font">Font</h3>
<input id="chk_prefs_auto_longer_tweet"
title="Compress tweet use hotot.in service if the tweet contains more than 140 charactors."
class="mochi_toggle widget"
type="checkbox" data-i18n-title="compress_tweet"/>
type="checkbox"/>
<label for="chk_prefs_auto_longer_tweet"
class="label"
data-i18n-text="auto_longer_tweet"
Expand Down
8 changes: 5 additions & 3 deletions data/js/background.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions data/js/conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ conf = {
vars: {
'platform': 'Linux'
, 'wrapper': 'unknown'
, 'version': '0.9.8.7'
, 'version': '0.9.8.8'
, 'codename': 'Ada'
, 'consumer_key': 'SCEdx4ZEOO68QDCTC7FFUQ'
, 'consumer_secret': '2IBoGkVrpwOo7UZhjkYYekw0ciXG1WHpsqQtUqZCSw'
Expand Down Expand Up @@ -57,6 +57,7 @@ default_prefs: {
, 'enable_animation': true
, 'enable_gpu_acceleration': true
// Behaviors
, 'auto_longer_tweet': true
, 'use_preload_conversation': true
, 'use_alt_retweet': false
, 'use_alt_reply': false
Expand Down Expand Up @@ -104,6 +105,7 @@ default_prefs: {
, 'enable_animation': true
, 'enable_gpu_acceleration': true
// Behaviors
, 'auto_longer_tweet': true
, 'use_preload_conversation': true
, 'use_alt_retweet': false
, 'use_alt_reply': false
Expand Down Expand Up @@ -397,7 +399,7 @@ var daily_hints = [
, 'Wanna quit hotot? try <Ctrl>+Q'
, 'I can act like VIM!'
, 'Need more columns? Try to extend my window'
, 'Need less columns? Try to resize my window to a small size'
, 'Need fewer columns? Try to resize my window to a small size'
, 'Go to "STAT" page, You\'ll see how addicted to twitter you are'
, 'This is a ALPHA version, full of bugs, and features'
, 'すっかり冷え込んだ日にはホットミルクとラブレターが恋しい'
Expand Down
1 change: 1 addition & 0 deletions data/js/lib.twitter.js
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,7 @@ function TwitterClient() {
var url = self.api_base + 'lists/statuses.json';
var params = {
'include_entities': '1',
'include_rts': '1',
'owner_screen_name': owner_screen_name,
'slug': slug
};
Expand Down
4 changes: 2 additions & 2 deletions data/js/notification.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ function check_proc() {

notify:
function notify(title, summary, image, type) {
title = title.replace(/&gt;/g, '>').replace(/&lt;/g, '<');
summary = summary.replace(/&gt;/g, '>').replace(/&lt;/g, '<');
title = title.replace(/&gt;/g, '>').replace(/&lt;/g, '<').replace(/&amp;/g, '&');
summary = summary.replace(/&gt;/g, '>').replace(/&lt;/g, '<').replace(/&amp;/g, '&');
if (util.is_native_platform()) {
hotot_action('system/notify/'
+ type
Expand Down
18 changes: 10 additions & 8 deletions data/js/ui.main.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ function init () {
ui.KismetDlg.guide_dialog.open();
});
});

$('#tweet_set_color_btn').click(
function (ev) {
var li = $(ui.Main.active_tweet_id);
Expand All @@ -75,10 +76,11 @@ function init () {
var text = $(ui.Main.active_tweet_id + ' .card_body').children('.text').text();
var reg_url = new RegExp('[a-zA-Z]+:\\/\\/(' + ui.Template.reg_url_path_chars_1+'+)');
var m = text.match(reg_url);
console.log(m)
if (m == null) return;
var url = m[1];

if (m == null){
var url = 'http://twitter.com/' + $(ui.Main.active_tweet_id).attr('screen_name') + '/status/' + $(ui.Main.active_tweet_id).attr('tweet_id');
} else {
var url = m[1];
};
toast.set('Save to ..').show();
globals.readLaterServ.addItem(
conf.get_current_profile().preferences.readlater_service,
Expand All @@ -89,7 +91,7 @@ function init () {
} else {
toast.set('Error Code:' + result).show()
}
});
});
});

$('#tweet_more_menu').mouseleave(function(){
Expand Down Expand Up @@ -560,9 +562,9 @@ function bind_tweet_action(id) {
{}, {}, null,
function (result) {
if (result && result.full_text) {
$(id).find('.text_inner a').unbind();
$(id).find('.text_inner').empty();
$(id).find('.text_inner').html(
$(id).find('.text_inner:eq(0) a').unbind();
$(id).find('.text_inner:eq(0)').empty();
$(id).find('.text_inner:eq(0)').html(
ui.Template.form_text_raw(result.full_text)
);
ui.Main.bind_tweet_text_action(id);
Expand Down
71 changes: 39 additions & 32 deletions data/js/ui.prefs_dlg.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,9 @@ function load_prefs() {
$('#range_prefs_line_height').val(prefs.line_height);
$('#range_prefs_line_height_st').text(Number(prefs.line_height).toFixed(1));
ui.PrefsDlg.update_font_preview();
$('#chk_prefs_auto_longer_tweet')
.attr('checked', prefs.auto_longer_tweet)
.prop('checked', prefs.auto_longer_tweet);
$('#chk_prefs_use_preload_conversation')
.attr('checked', prefs.use_preload_conversation)
.prop('checked', prefs.use_preload_conversation);
Expand Down Expand Up @@ -331,59 +334,63 @@ save_prefs:
function save_prefs() {
var prefs = conf.get_current_profile().preferences;
// Looks & Feels
prefs['lang'] = $('#sel_prefs_lang').val();

prefs['theme'] = $('#sel_prefs_theme').val();
prefs['theme_path'] = $('#sel_prefs_theme').children('option[value="'+$('#sel_prefs_theme').val()+'"]').attr('path');
prefs['custom_font'] = $('#tbox_prefs_custom_font').val();
prefs['font_size'] = $('#range_prefs_font_size').val();
if (prefs['font_size'] == '') {
prefs['font_size'] = 12;
prefs.lang = $('#sel_prefs_lang').val();

prefs.theme = $('#sel_prefs_theme').val();
prefs.theme_path = $('#sel_prefs_theme').children('option[value="'+$('#sel_prefs_theme').val()+'"]').attr('path');
prefs.custom_font = $('#tbox_prefs_custom_font').val();
prefs.font_size = $('#range_prefs_font_size').val();
if (prefs.font_size === '') {
prefs.font_size = 12;
}
prefs['line_height'] = $('#range_prefs_line_height').val();
if (prefs['line_height'] == '') {
prefs['line_height'] = 1.4;
prefs.line_height = $('#range_prefs_line_height').val();
if (prefs.line_height === '') {
prefs.line_height = 1.4;
}
prefs['use_custom_font'] = $('#chk_use_custom_font').prop('checked');
prefs.use_custom_font = $('#chk_use_custom_font').prop('checked');
// behaviors
prefs['use_preload_conversation']
prefs.auto_longer_tweet
= $('#chk_prefs_auto_longer_tweet').prop('checked');

prefs.use_preload_conversation
= $('#chk_prefs_use_preload_conversation').prop('checked');
prefs['use_alt_retweet']
prefs.use_alt_retweet
= $('#chk_prefs_use_alt_retweet').prop('checked');
prefs['use_alt_reply']
prefs.use_alt_reply
= $('#chk_prefs_use_alt_reply').prop('checked');

prefs['use_media_preview']
prefs.use_media_preview
= $('#chk_prefs_use_media_preview').prop('checked');
prefs['use_deleted_mark']
prefs.use_deleted_mark
= $('#chk_prefs_use_deleted_mark').prop('checked');
prefs['default_picture_service'] = $('#sel_prefs_default_picture_service').val();
prefs.default_picture_service
= $('#sel_prefs_default_picture_service').val();

prefs['use_readlater_serv'] = $('#chk_prefs_use_readlater_serv').prop('checked');
prefs['readlater_service'] = $('#sel_prefs_readlater_service').val();
prefs['readlater_username'] = $('#tbox_prefs_readlater_username').val();
prefs['readlater_password'] = $('#tbox_prefs_readlater_password').val();
prefs.use_readlater_serv = $('#chk_prefs_use_readlater_serv').prop('checked');
prefs.readlater_service = $('#sel_prefs_readlater_service').val();
prefs.readlater_username = $('#tbox_prefs_readlater_username').val();
prefs.readlater_password = $('#tbox_prefs_readlater_password').val();

// Advanced
prefs['enable_animation']
prefs.enable_animation
= $('#chk_prefs_enable_animation').prop('checked');
prefs['enable_gpu_acceleration']
prefs.enable_gpu_acceleration
= $('#chk_prefs_enable_gpu_acceleration').prop('checked');
prefs['api_base']
prefs.api_base
= $('#tbox_prefs_api_base').attr('value');
prefs['sign_api_base']
prefs.sign_api_base
= $('#tbox_prefs_sign_api_base').attr('value');
prefs['search_api_base2']
prefs.search_api_base2
= $('#tbox_prefs_search_api_base2').attr('value');
prefs['upload_api_base']
prefs.upload_api_base
= $('#tbox_prefs_upload_api_base').attr('value');
prefs['oauth_base']
prefs.oauth_base
= $('#tbox_prefs_oauth_base').attr('value');
prefs['sign_oauth_base']
prefs.sign_oauth_base
= $('#tbox_prefs_sign_oauth_base').attr('value');
prefs['use_same_sign_api_base']
prefs.use_same_sign_api_base
= $('#chk_prefs_use_same_sign_api_base').prop('checked');
prefs['use_same_sign_oauth_base']
prefs.use_same_sign_oauth_base
= $('#chk_prefs_use_same_sign_oauth_base').prop('checked');
// apply & save
conf.apply_prefs(conf.current_name, true);
Expand Down
69 changes: 66 additions & 3 deletions data/js/ui.searchview.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
if (typeof ui == 'undefined') var ui = {};
ui.SearchView = {
since_id: null,
alter_load: null,
alter_load_success: null,
alter_item_type: null,
init:
function init() {

ui.SearchView.alter_item_type = 'phoenix_search';
ui.SearchView.alter_load = ui.SearchView.load_tweet;
ui.SearchView.alter_load_success = ui.SearchView.load_tweet_success;
},

init_view:
Expand All @@ -15,8 +20,11 @@ function init_search_view(view) {
}
});
view._header.find('.search_entry_clear_btn').click(function () {
// clear
search_entry.val('');
ui.SearchView.clear(view);
// switch to trending view

});
var toggle = view._header.find('.search_view_toggle');
var sub_view_btns = toggle.find('.mochi_button_group_item');
Expand Down Expand Up @@ -69,6 +77,7 @@ function init_search_view(view) {
});

widget.autocomplete.connect(search_entry);
ui.SearchView.clear(view);
},

destroy_view:
Expand Down Expand Up @@ -103,6 +112,11 @@ function switch_sub_view(view, name) {
break;
default: break;
}

ui.SearchView.alter_item_type = view.item_type;
ui.SearchView.alter_load = view._load;
ui.SearchView.alter_load_success = view._load_success;

var search_entry = view._header.find('.search_entry');
ui.SearchView.do_search(view, search_entry.val());
},
Expand Down Expand Up @@ -209,26 +223,75 @@ function loadmore_people_success(view, json) {

do_search:
function do_search(view, query) {

if (!ui.Main.views.hasOwnProperty('search')) {
ui.Slider.addDefaultView('search', {});
view = ui.Main.views.search;
}
ui.SearchView.clear(view);
ui.SearchView.clear(view, true);
if (ui.SearchView.alter_load != null) {
view.item_type = ui.SearchView.alter_item_type;
view._load = ui.SearchView.alter_load;
view._load_success = ui.SearchView.alter_load_success;
}
view.query = $.trim(query);
if (view.query.length == 0) return;
view.load();
},

clear:
function clear(view) {
function clear(view, noTrend) {
view._header.find('.search_people_result').hide();
ui.SearchView.since_id = null;
view.max_id = null;
view.since_id = null;
view.query = '';
view.clear();
ui.SearchView.since_id = 0;
if (noTrend !== true) {
view.item_type = "page";
view._load = ui.SearchView.get_trending_topics_worldwide;
view._load_success = ui.SearchView.get_trending_topics_success;
view.former = ui.Template.form_tweet;
view.load();
}
},

get_trending_topics_local:
function get_trending_topics_local(view, success, fail) {
if (ui.TrendingTopicsView.woeid == null) {
$.get('http://www.loc4lize.me/localize.json', function(data) {
ui.TrendingTopicsView.woeid = data.geo.woeid;
ui.TrendingTopicsView.city = data.geo.city;
$('.trending_topics_local').html('Local (' + data.geo.city + ')');
globals.twitterClient.get_trending_topics(ui.TrendingTopicsView.woeid, success);
});
} else {
globals.twitterClient.get_trending_topics(ui.TrendingTopicsView.woeid, success);
}
return 1; // There are always trend topics
},

get_trending_topics_worldwide:
function get_trending_topics_worldwide(view, success, fail) {
globals.twitterClient.get_trending_topics(1, success);
return 1; // There are always trend topics
},

get_trending_topics_success:
function get_trending_topics_success(self, json) {
var trend_list = json[0].trends;
var i = 1;
for (trend_name in trend_list) {
var m = ui.Template.trending_topic_m;
m.ID = i;
m.NAME = trend_list[trend_name].name;
self._body.append(ui.Template.render(ui.Template.trending_topic_t, m));
i++;
}
ui.Main.bind_tweet_action(self._body);
}


};

19 changes: 0 additions & 19 deletions data/js/ui.slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -845,25 +845,6 @@ function addDefaultView(name, opts) {
, 'is_trim': false
}, opts));
break;
case 'trending_topics':
ui.Slider.add('trending_topics'
, {title: _('trending_topics'), icon:'image/ic_list.png'}
, $.extend({ 'type':'tweet', 'title': _('trending_topics')
, '_load': ui.TrendingTopicsView.get_trending_topics_local
, '_load_success': ui.TrendingTopicsView.get_trending_topics_success
, 'init': ui.TrendingTopicsView.init_view
, 'destroy': function (view) {
ui.Slider.remove(view.name);
}
, 'header_html': ui.Template.common_column_header_t
, 'header_html_ex': ui.Template.trending_topics_header_t
, 'former': ui.Template.form_tweet
, 'method': 'poll'
, 'interval': 360
, 'item_type': 'page'
, 'is_trim': false
}, opts));
break;
default: break;
}
return true;
Expand Down
Loading

0 comments on commit b8644e9

Please sign in to comment.