From 0c1dbae4e6dc327b7dd6dee67324d2c8ee27d0e5 Mon Sep 17 00:00:00 2001 From: Simon Grim Date: Fri, 31 Oct 2014 22:45:34 +0600 Subject: [PATCH 1/3] fix switch-to-normal/promoted-posts to be compatible with different themes. add polyglot.t() to strings --- js/interface_home.js | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/js/interface_home.js b/js/interface_home.js index 5c930d6..f386194 100644 --- a/js/interface_home.js +++ b/js/interface_home.js @@ -13,34 +13,32 @@ var InterfaceFunctions = function() //faço os binds no init this.init = function() { + var theme = $.Options.getTheme(); + $( ".wrapper .postboard-news").click(function() { 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 $( ".userMenu-home.current a").click(function() { requestTimelineUpdate("latest",postsPerRefresh,followingUsers,promotedPostsOnly);}); - // modified the way promoted posts are shown - $( ".promoted-posts-only").click(function() { + $( ".promoted-posts-only").click(function() { promotedPostsOnly = !promotedPostsOnly; - //active promoted posts tab - $(this).children('.promoted-posts').addClass(promotedPostsOnly ? "active" : "disabled"); - $(this).children('.normal-posts').addClass(promotedPostsOnly ? "disabled" : "active"); - $('#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"); + + if(theme == 'nin') + { + // modify the way promoted posts are shown + //active promoted posts tab + $(this).children('.promoted-posts').addClass(promotedPostsOnly ? "active" : "disabled"); + $(this).children('.normal-posts').addClass(promotedPostsOnly ? "disabled" : "active"); + $('#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(); $.MAL.getStreamPostsParent().empty(); From 70e38192de0ce24cb0d29c083a78ffd254961cc0 Mon Sep 17 00:00:00 2001 From: Simon Grim Date: Fri, 31 Oct 2014 22:58:50 +0600 Subject: [PATCH 2/3] fix switch-to-normal/promoted-posts to be compatible with different themes. add polyglot.t() to strings --- js/interface_home.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/interface_home.js b/js/interface_home.js index f386194..70f14f0 100644 --- a/js/interface_home.js +++ b/js/interface_home.js @@ -22,12 +22,12 @@ var InterfaceFunctions = function() $( ".userMenu-home.current a").click(function() { requestTimelineUpdate("latest",postsPerRefresh,followingUsers,promotedPostsOnly);}); - $( ".promoted-posts-only").click(function() { + $( ".promoted-posts-only").click(function() { promotedPostsOnly = !promotedPostsOnly; if(theme == 'nin') { - // modify the way promoted posts are shown + // modify the way promoted posts are shown //active promoted posts tab $(this).children('.promoted-posts').addClass(promotedPostsOnly ? "active" : "disabled"); $(this).children('.normal-posts').addClass(promotedPostsOnly ? "disabled" : "active"); From b34bd7d027c31db1f6fdd68905e1abb79264dd12 Mon Sep 17 00:00:00 2001 From: Simon Grim Date: Tue, 4 Nov 2014 22:34:42 +0600 Subject: [PATCH 3/3] move theme-specific JS to theme-related files --- js/interface_common.js | 2 ++ js/interface_home.js | 17 ----------------- theme_nin/js/theme_option.js | 22 +++++++++++++++++----- theme_original/js/theme_option.js | 8 ++++++++ 4 files changed, 27 insertions(+), 22 deletions(-) create mode 100755 theme_original/js/theme_option.js diff --git a/js/interface_common.js b/js/interface_common.js index ba93950..04f97e2 100644 --- a/js/interface_common.js +++ b/js/interface_common.js @@ -1229,7 +1229,9 @@ function changeStyle() { { style = 'css/style.css'; profile = 'css/profile.css'; + $.getScript('theme_original/js/theme_option.js'); } + $('#stylecss').attr('href', style); $('#profilecss').attr('href', profile); $("