Открепление верхней панели ВКонтакте (VK)

Открепление верхней панели в социальной сети ВКонтакте (новый дизайн) при прокрутке страницы.

目前為 2016-09-17 提交的版本,檢視 最新版本

// ==UserScript==
// @name         Открепление верхней панели ВКонтакте (VK)
// @namespace    FIX
// @version      0.10
// @description  Открепление верхней панели в социальной сети ВКонтакте (новый дизайн) при прокрутке страницы.
// @author       raletag
// @include      *://vk.com/*
// @exclude      *://vk.com/notifier.php*
// @exclude      *://vk.com/*widget*.php*
// @require      https://code.jquery.com/jquery-3.1.0.min.js
// @grant        GM_addStyle
// ==/UserScript==

(function() {
    'use strict';
    new GM_addStyle('.headefix .ui_search_fixed {top: 0px!important;} .headefix .side_bar_inner{margin-top: 0px;} .headefix .photos_period_delimiter_fixed{margin: 0px 0 0 -20px!important;} .headefix ._audio_rows_header.audio_rows_header.fixed{top:0px!important;} .headefix #stl_bg {padding-top: 20px!important;}');
    var ishide = false, playing;
    if ($(window).scrollTop() > 42 && $.inArray($(location).attr('pathname'),['/im']) === -1) { // убрать панель
        $('#page_header_cont').slideUp(100);
        $('body').addClass('headefix');
        ishide = true;
        //console.log('HIDE TOP PANEL');
    }
    $(window).scroll(function() {
        playing = $('#top_audio_player').hasClass('top_audio_player_playing');
        if (!ishide && ($.inArray($(location).attr('pathname'),['/im']) !== -1 || playing)) return;
        if ($(window).scrollTop() > 42 && !playing) {
            if (!ishide) { // убрать панель
                $('#page_header_cont').slideUp(100);
                $('body').addClass('headefix');
                ishide = true;
                //console.log('HIDE TOP PANEL');
            }
        } else if (ishide) { // показать панель
            $('#page_header_cont').slideDown(100);
            $('#side_bar_inner').css('margin-top','');
            $('body').removeClass('headefix');
            ishide = false;
            //console.log('SHOW TOP PANEL');
        }
    });
})();