2015-07-28 10:40:52 +02:00
|
|
|
$(window).resize(function()
|
2015-07-26 21:39:11 +02:00
|
|
|
{
|
2015-08-10 05:59:24 +02:00
|
|
|
testRightSide();
|
2015-07-31 10:58:25 +02:00
|
|
|
reAppendModules();
|
2015-07-26 21:39:11 +02:00
|
|
|
});
|
|
|
|
|
2015-08-10 06:12:31 +02:00
|
|
|
$(window).load(function()
|
|
|
|
{
|
|
|
|
testRightSide();
|
|
|
|
});
|
2015-08-10 05:56:39 +02:00
|
|
|
|
|
|
|
|
2015-07-28 10:40:52 +02:00
|
|
|
$(document).ready(function()
|
2015-07-26 21:39:11 +02:00
|
|
|
{
|
2015-07-31 10:58:25 +02:00
|
|
|
var windowHeight = $(window).height();
|
2015-08-03 16:20:22 +02:00
|
|
|
|
2015-08-10 05:56:39 +02:00
|
|
|
testRightSide();
|
2015-08-10 06:12:31 +02:00
|
|
|
reOrganizeTemplates();
|
2015-08-18 16:49:56 +05:00
|
|
|
|
|
|
|
$.globalEval(postToElem.toString().replace(/postContext.append\(_templatePostRtBy/,
|
|
|
|
'postContext.addClass(\'post-retransmited-by-container\').prependTo(postContext.parent()).append(_templatePostRtBy'));
|
2015-07-29 06:05:10 +02:00
|
|
|
|
2015-07-26 21:39:11 +02:00
|
|
|
$( '.userMenu-home.current a' ).on( 'click', function() {
|
|
|
|
$('html, body').animate({scrollTop:0},300);
|
|
|
|
return false
|
|
|
|
});
|
|
|
|
|
|
|
|
// modify the way promoted posts are shown
|
2015-07-31 10:58:25 +02:00
|
|
|
$( ".promoted-posts-only").click(function() {
|
2015-07-26 21:39:11 +02:00
|
|
|
//active promoted posts tab
|
|
|
|
$(this).children('.promoted-posts').addClass(promotedPostsOnly ? "active" : "disabled");
|
|
|
|
$(this).children('.normal-posts').addClass(promotedPostsOnly ? "disabled" : "active");
|
2015-07-29 06:05:10 +02:00
|
|
|
$('#postboard-top').removeClass(promotedPostsOnly ? "show" : "hide");
|
2015-07-26 21:39:11 +02:00
|
|
|
//active normal posts
|
|
|
|
$(this).children('.promoted-posts').removeClass(promotedPostsOnly ? "disabled" : "active");
|
|
|
|
$(this).children('.normal-posts').removeClass(promotedPostsOnly ? "active" : "disabled");
|
2015-07-29 06:05:10 +02:00
|
|
|
$('#postboard-top').addClass(promotedPostsOnly ? "hide" : "show");
|
2015-07-26 21:39:11 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
$(".userMenu-search-profiles .follow")
|
|
|
|
.on("eventToggleFollow", function() {
|
2015-07-29 03:28:09 +02:00
|
|
|
$(this).text('+').attr('title', polyglot.t('Follow'));
|
2015-07-26 21:39:11 +02:00
|
|
|
})
|
|
|
|
.on("eventToggleUnfollow", function() {
|
2015-07-29 03:28:09 +02:00
|
|
|
$(this).text('-').attr('title', polyglot.t('Unfollow'));
|
2015-07-26 21:39:11 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
if (/\/options.html$/i.test(document.location))
|
|
|
|
$(document).ready(localizeLabels);
|
|
|
|
|
2015-07-31 10:58:25 +02:00
|
|
|
$(window).scroll(function(){
|
|
|
|
window_scrollY = window.pageYOffset; // declare variable here for screen not to scroll when closing modals
|
2015-08-21 06:10:45 +02:00
|
|
|
if ( (window_scrollY >= 300) && (!$('#postboard-top').hasClass('.onTop')) ) {$('#postboard-top').addClass('onTop')} // switch #postboard-top when scrolling
|
|
|
|
else
|
|
|
|
{$('#postboard-top').removeClass('onTop')}
|
2015-07-31 10:58:25 +02:00
|
|
|
});
|
|
|
|
|
2015-08-01 22:52:31 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-08-10 05:56:39 +02:00
|
|
|
function testRightSide() { // if rightside is empty, don't show it and engarge postboard
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( ( $('.toptrends').html() == '' ) && ($('.who-to-follow').html() == '') && ( $('.twistday-reminder').html() == '' ) ){
|
|
|
|
$('.dashboard.right').css('display: none');
|
|
|
|
$('.wrapper .postboard').addClass('large');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
$('.dashboard.right').css('display: block');
|
|
|
|
$('.wrapper .postboard').removeClass('large');
|
|
|
|
}
|
|
|
|
|
2015-07-31 10:58:25 +02:00
|
|
|
}
|
2015-08-01 22:52:31 +02:00
|
|
|
|
|
|
|
|
2015-07-31 10:58:25 +02:00
|
|
|
|
2015-08-10 05:56:39 +02:00
|
|
|
|
|
|
|
|
2015-07-31 10:58:25 +02:00
|
|
|
function reOrganizeTemplates() { // for nin's templating
|
2015-07-26 21:39:11 +02:00
|
|
|
|
2015-07-31 10:58:25 +02:00
|
|
|
reAppendModules();
|
|
|
|
|
|
|
|
//removes unused html
|
|
|
|
$('.modal-close').html('');
|
|
|
|
$('.modal-back').html('');
|
|
|
|
$('.twister-user-remove').html('');
|
|
|
|
$('.profile-card-main').attr('style', '');
|
|
|
|
$('.userMenu-search-profiles button').html('+').attr('title',polyglot.t('Follow'));
|
|
|
|
$('.mini-profile-actions span').html('');
|
|
|
|
|
|
|
|
//re-organizes
|
|
|
|
$('.promoted-posts-only').detach().appendTo($('.left .mini-profile'));
|
|
|
|
$('.mini-profile .open-following-page').parent('li').detach().appendTo($('.mini-profile-indicators'));
|
|
|
|
$('.mini-profile-indicators').detach().insertAfter($('.dashboard.left .profile-data'));
|
|
|
|
|
2015-08-03 16:20:22 +02:00
|
|
|
///// page profile
|
2015-08-10 06:17:22 +02:00
|
|
|
$('.forEdition .profile-card-main h2').detach().insertBefore($('.profile-card-main'));
|
2015-08-01 22:52:31 +02:00
|
|
|
|
2015-07-31 10:58:25 +02:00
|
|
|
//loader
|
|
|
|
newLoader()
|
|
|
|
}
|
2015-07-26 21:39:11 +02:00
|
|
|
|
2015-07-31 10:58:25 +02:00
|
|
|
function reAppendModules() { // avoid w1200 things
|
|
|
|
$('.module.toptrends').detach().appendTo($('.dashboard.right'));
|
|
|
|
$('.module.who-to-follow').detach().appendTo($('.dashboard.right'));
|
|
|
|
$('.module.twistday-reminder').detach().appendTo($('.dashboard.right'));
|
|
|
|
}
|
2015-07-26 21:39:11 +02:00
|
|
|
|
|
|
|
|
2015-07-31 10:58:25 +02:00
|
|
|
function newLoader() { // create divs for new loader
|
|
|
|
$('<div></div>').appendTo('.postboard-loading');
|
|
|
|
$('<div></div>').appendTo('.postboard-loading');
|
|
|
|
$('<div></div>').appendTo('.postboard-loading');
|
|
|
|
}
|
2015-07-26 21:39:11 +02:00
|
|
|
|
|
|
|
function localizeLabels() {
|
|
|
|
$("label[for=tab_language]").text(polyglot.t("Language"));
|
|
|
|
$("label[for=t-2]").text(polyglot.t("Theme"));
|
|
|
|
$("label[for=t-3]").text(polyglot.t("Notifications"));
|
|
|
|
$("label[for=t-4]").text(polyglot.t("Keys"));
|
|
|
|
$("label[for=t-5]").text(polyglot.t("Appearance"));
|
|
|
|
$("label[for=t-6]").text(polyglot.t("Users"));
|
|
|
|
}
|
|
|
|
|
|
|
|
function openModal(modal) {
|
2015-07-31 10:58:25 +02:00
|
|
|
|
|
|
|
var windowHeight = $(window).height();
|
2015-07-26 21:39:11 +02:00
|
|
|
if (!modal.classBase)
|
|
|
|
modal.classBase = '.modal-wrapper';
|
|
|
|
|
|
|
|
$(modal.classBase + ':not(#templates *)').remove();
|
|
|
|
|
|
|
|
modal.self = $('#templates ' + modal.classBase).clone(true)
|
|
|
|
.addClass(modal.classAdd);
|
|
|
|
|
|
|
|
if (modal.title)
|
|
|
|
modal.self.find('.modal-header h3').html(modal.title);
|
|
|
|
if (modal.content)
|
|
|
|
modal.content = modal.self.find('.modal-content')
|
|
|
|
.append(modal.content);
|
|
|
|
else
|
|
|
|
modal.content = modal.self.find('.modal-content');
|
2015-07-28 10:40:52 +02:00
|
|
|
modal.postboard = modal.self.find('.postboard-posts');
|
|
|
|
|
2015-08-01 22:52:31 +02:00
|
|
|
modal.self.prependTo('body').slideDown();
|
2015-07-28 10:40:52 +02:00
|
|
|
|
2015-07-26 21:39:11 +02:00
|
|
|
|
|
|
|
if (modal.classBase === '.modal-wrapper') {
|
|
|
|
modal.content.outerHeight(modal.self.height() - modal.self.find('.modal-header').outerHeight());
|
|
|
|
|
|
|
|
if (modal.self.outerHeight() > windowHeight) {
|
|
|
|
modal.content.outerHeight(modal.content.outerHeight() - modal.self.outerHeight() + windowHeight);
|
|
|
|
modal.self.outerHeight(windowHeight);
|
|
|
|
modal.self.css('margin-top', - windowHeight / 2);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return modal;
|
|
|
|
}
|
2015-07-31 10:58:25 +02:00
|
|
|
|