// interface_home.js // 2013 Lucas Leal, Miguel Freitas // // Specific interface functions for home.html var promotedPostsOnly = false; //*********************************************** //******************* DECLARATIONS ************** //*********************************************** 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);}); // Add refresh posts for home link in menu $( ".userMenu-home.current a").click(function() { requestTimelineUpdate("latest",postsPerRefresh,followingUsers,promotedPostsOnly);}); $( ".promoted-posts-only").click(function() { promotedPostsOnly = !promotedPostsOnly; 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(); requestTimelineUpdate("latestFirstTime",postsPerRefresh,followingUsers,promotedPostsOnly); }); initInterfaceCommon(); initUserSearch(); initInterfaceDirectMsg(); initUser(initHome); }; function initHome(cbFunc, cbArg) { checkNetworkStatusAndAskRedirect(); //$("span.screen-name").text('@' + user); var $miniProfile = $(".mini-profile"); if(!defaultScreenName) { $(".userMenu-profile > a").text(polyglot.t("Login")); $(".userMenu-profile > a").attr("href","login.html"); $(".post-area-new > textarea").attr("placeholder",polyglot.t("You have to log in to post messages.")); $(".post-area-new > textarea").attr("disabled","true"); $miniProfile.find(".mini-profile-name").text("guest"); $miniProfile.find(".posts-count").text("0"); $miniProfile.find(".following-count").text("0"); $miniProfile.find(".followers-count").text("0"); $miniProfile.find("a.open-following-page").attr("href","#"); $miniProfile.find("a.open-following-page").bind("click", function() { alert(polyglot.t("You are not following anyone because you are not logged in."))} ); $miniProfile.find("a.open-followers").bind("click", function() { alert(polyglot.t("You don't have any followers because you are not logged in."))} ); $(".dropdown-menu-following").attr("href","#"); $(".dropdown-menu-following").bind("click", function() { alert(polyglot.t("You are not following anyone because you are not logged in."))} ); twisterRpc("gettrendinghashtags", [10], function(args, ret) { for( var i = 0; i < ret.length; i++ ) { var $li = $("