Browse Source

move theme-specific JS to theme-related files

master
Simon Grim 10 years ago
parent
commit
b34bd7d027
  1. 2
      js/interface_common.js
  2. 17
      js/interface_home.js
  3. 22
      theme_nin/js/theme_option.js
  4. 8
      theme_original/js/theme_option.js

2
js/interface_common.js

@ -1229,7 +1229,9 @@ function changeStyle() {
{ {
style = 'css/style.css'; style = 'css/style.css';
profile = 'css/profile.css'; profile = 'css/profile.css';
$.getScript('theme_original/js/theme_option.js');
} }
$('#stylecss').attr('href', style); $('#stylecss').attr('href', style);
$('#profilecss').attr('href', profile); $('#profilecss').attr('href', profile);
$("<style type='text/css'> .selectable_theme:not(.theme_" + theme + ")" + $("<style type='text/css'> .selectable_theme:not(.theme_" + theme + ")" +

17
js/interface_home.js

@ -13,8 +13,6 @@ 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);});
@ -25,21 +23,6 @@ var InterfaceFunctions = function()
$( ".promoted-posts-only").click(function() { $( ".promoted-posts-only").click(function() {
promotedPostsOnly = !promotedPostsOnly; 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(); timelineChangedUser();
$.MAL.getStreamPostsParent().empty(); $.MAL.getStreamPostsParent().empty();
requestTimelineUpdate("latestFirstTime",postsPerRefresh,followingUsers,promotedPostsOnly); requestTimelineUpdate("latestFirstTime",postsPerRefresh,followingUsers,promotedPostsOnly);

22
theme_nin/js/theme_option.js

@ -1,21 +1,33 @@
$(function(){ $(function(){
$('#closeModal').html(''); $('#closeModal').html('');
$('.profile-card-main').attr('style', ''); $('.profile-card-main').attr('style', '');
$('img[src$="img/tornado_avatar.png"]').attr("src","theme_nin/img/tornado_avatar.png"); $('img[src$="img/tornado_avatar.png"]').attr("src","theme_nin/img/tornado_avatar.png");
$('.userMenu-search-profiles button').html('').attr('title',polyglot.t('Follow')); $('.userMenu-search-profiles button').html('').attr('title',polyglot.t('Follow'));
$('.mini-profile-actions span').html(''); $('.mini-profile-actions span').html('');
$('.post-context').each(function(){ $('.post-context').each(function(){
$(this).prependTo($(this).parent()); $(this).prependTo($(this).parent());
}); });
$( '.userMenu-home.current a' ).on( 'click', function() { $( '.userMenu-home.current a' ).on( 'click', function() {
$('html, body').animate({scrollTop:0},300); $('html, body').animate({scrollTop:0},300);
return false return false
}); });
$( ".promoted-posts-only").click(function() {
// 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");
});
$(window).scroll(function(){ $(window).scroll(function(){
posScroll = $(document).scrollTop(); posScroll = $(document).scrollTop();
if(posScroll >= 250) if(posScroll >= 250)

8
theme_original/js/theme_option.js

@ -0,0 +1,8 @@
$(function(){
$( ".promoted-posts-only").click(function() {
$(this).text( promotedPostsOnly ? polyglot.t('Switch to Normal posts') : polyglot.t('Switch to Promoted posts') );
});
});
Loading…
Cancel
Save