Browse Source

fix switch-to-normal/promoted-posts to be compatible with different themes. add polyglot.t() to strings

master
Simon Grim 10 years ago
parent
commit
0c1dbae4e6
  1. 38
      js/interface_home.js

38
js/interface_home.js

@ -13,34 +13,32 @@ var InterfaceFunctions = function()
//faço os binds no init //faço os binds no init
this.init = function() this.init = function()
{ {
var theme = $.Options.getTheme();
$( ".wrapper .postboard-news").click(function() { $( ".wrapper .postboard-news").click(function() {
requestTimelineUpdate("latest",postsPerRefresh,followingUsers,promotedPostsOnly);}); requestTimelineUpdate("latest",postsPerRefresh,followingUsers,promotedPostsOnly);});
/*$( ".promoted-posts-only").click(function() {
promotedPostsOnly = !promotedPostsOnly;
$(this).text( promotedPostsOnly ? "Switch to Normal posts" : "Switch to Promoted posts" );
timelineChangedUser();
$.MAL.getStreamPostsParent().empty();
requestTimelineUpdate("latestFirstTime",postsPerRefresh,followingUsers,promotedPostsOnly);
});*/
// Add refresh posts for home link in menu // Add refresh posts for home link in menu
$( ".userMenu-home.current a").click(function() { $( ".userMenu-home.current a").click(function() {
requestTimelineUpdate("latest",postsPerRefresh,followingUsers,promotedPostsOnly);}); requestTimelineUpdate("latest",postsPerRefresh,followingUsers,promotedPostsOnly);});
// modified the way promoted posts are shown $( ".promoted-posts-only").click(function() {
$( ".promoted-posts-only").click(function() {
promotedPostsOnly = !promotedPostsOnly; promotedPostsOnly = !promotedPostsOnly;
//active promoted posts tab
$(this).children('.promoted-posts').addClass(promotedPostsOnly ? "active" : "disabled"); if(theme == 'nin')
$(this).children('.normal-posts').addClass(promotedPostsOnly ? "disabled" : "active"); {
$('#postboard-top').removeClass(promotedPostsOnly ? "show" : "hide"); // modify the way promoted posts are shown
//active normal posts //active promoted posts tab
$(this).children('.promoted-posts').removeClass(promotedPostsOnly ? "disabled" : "active"); $(this).children('.promoted-posts').addClass(promotedPostsOnly ? "active" : "disabled");
$(this).children('.normal-posts').removeClass(promotedPostsOnly ? "active" : "disabled"); $(this).children('.normal-posts').addClass(promotedPostsOnly ? "disabled" : "active");
$('#postboard-top').addClass(promotedPostsOnly ? "hide" : "show"); $('#postboard-top').removeClass(promotedPostsOnly ? "show" : "hide");
//active normal posts
$(this).children('.promoted-posts').removeClass(promotedPostsOnly ? "disabled" : "active");
$(this).children('.normal-posts').removeClass(promotedPostsOnly ? "active" : "disabled");
$('#postboard-top').addClass(promotedPostsOnly ? "hide" : "show");
} else {
$(this).text( promotedPostsOnly ? polyglot.t('Switch to Normal posts') : polyglot.t('Switch to Promoted posts') );
}
timelineChangedUser(); timelineChangedUser();
$.MAL.getStreamPostsParent().empty(); $.MAL.getStreamPostsParent().empty();

Loading…
Cancel
Save