Window floating container

Adds a fixed header element for use by other scripts

As of 2016-11-29. See the latest version.

This script should not be not be installed directly. It is a library for other scripts to include with the meta directive // @require https://update.greasyfork.org/scripts/18233/160540/Window%20floating%20container.js

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Window floating container 
// @version      1.1.6
// @description  Adds a fixed header element for use by other scripts
// @author       @_jnblog
// @require      https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js
// @grant        GM_addStyle
// @grant        GM_getValue
// @grant        GM_setValue
// ==/UserScript==
/* jshint -W097 */
/* global $ */
/* jshint asi: true, multistr: true */
'use strict'


function getFloater() {
  return $('#ijgWindowFloater')
}

var ijgFloater = getFloater()

if (!$('#ijgWindowFloater').length) {
  ijgFloater = $('<div id="ijgWindowFloater">')
  $('.nav-TopSpacer').append(ijgFloater).css('position', 'relative')
  addStyles()

  $('<i class="ijgWindowFloater-toggle">')
      .appendTo(ijgFloater)
      .on('click', function() {
    $('#ijgWindowFloater').toggleClass('ijg-is-closed')
    GM_setValue('ijgWindowFloater-closed', $('#ijgWindowFloater').hasClass('ijg-is-closed'))
  })

  var isClosed = GM_getValue('ijgWindowFloater-closed')
  if (isClosed || typeof ijgWindowFloater-closed === 'undefined') {
    $('#ijgWindowFloater').addClass('ijg-is-closed')
  }
}



function addStyles () {
  GM_addStyle('#ijgWindowFloater {\
    position: absolute;\
    top: 100%;\
    left: 0;\
    z-index: 2000;\
    color: white;\
    background-color: #EB6841;\
  }\
  #ijgWindowFloater a {\
    color: white !important;\
    padding: 5px;\
    display: inline-block;\
  }\
  #ijgWindowFloater a:hover {\
    color: #FAF667 !important;\
  }\
  .ijgWindowFloater-item {\
    vertical-align: middle;\
    padding-left: .6em;\
    padding-right: .2em;\
    white-space: nowrap;\
  }\
  .ijg-is-closed .ijgWindowFloater-item {\
    display: none;\
  }\
  .ijgWindowFloater-toggle {\
    background-color: transparent;\
    box-shadow: inset 0 0 0 32px;\
    -webkit-transform-origin: right;\
    -ms-transform-origin: right;\
    transform-origin: right;\
    transform: rotate(180deg);\
    vertical-align: middle;\
    display: inline-block;\
    position: relative;\
    font-style: normal;\
    color: transparent;\
    text-align: left;\
    text-indent: -9999px;\
    direction: ltr;\
    box-sizing: border-box;\
    border: 2px solid white;\
    transition: all .2s;\
    border-radius: 50%;\
    width: 24px;\
    height: 24px;\
    margin: 2px 5px 3px 2px;\
    padding: 0;\
    top: 0;\
    left: -22px;\
  }\
  .ijgWindowFloater-toggle:before,\
  .ijgWindowFloater-toggle:after {\
    content: "";\
    width: 14px;\
    height: 2px;\
    position: absolute;\
    bottom: 0;\
    margin: auto 0;\
    box-shadow: inset 0 0 0 32px;\
    -webkit-transform-origin: right;\
    -ms-transform-origin: right;\
    transform-origin: right;\
    pointer-events: none;\
    width: 9px;\
    right: 6.5px;\
    color: white;\
  }\
  .ijgWindowFloater-toggle:before {\
    top: 2px;\
    -webkit-transform: rotate(45deg);\
    -ms-transform: rotate(45deg);\
    transform: rotate(45deg);\
  }\
  .ijgWindowFloater-toggle:after {\
    top: 0;\
    -webkit-transform: rotate(-45deg);\
    -ms-transform: rotate(-45deg);\
    transform: rotate(-45deg);\
  }\
  .ijg-is-closed .ijgWindowFloater-toggle:before {\
    top: 12px;\
    right: 8px;\
  }\
  .ijg-is-closed .ijgWindowFloater-toggle:after {\
    top: -10px;\
    right: 8px;\
  }')
}