Greasy Fork

Greasy Fork is available in English.

Amazon Pivot - amazon.de

On click enlarges the amamzon search bar in portrait mode

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name           Amazon Pivot - amazon.de
// @name:de        Amazon Hochkant - amazon.de
// @namespace      meyerk.com
// @match          https://*.amazon.*/*
// @grant          none
// @version        1.6
// @author         MeyerK
// @description    On click enlarges the amamzon search bar in portrait mode
// @description:de Vergrößert auf Klick die Suchleiste im Portät Modus (Desktop)
// @runat          document-end
// ==/UserScript==


class AmazonPivot
{
  constructor()
  {
    this.ttstb = null;
    this.navSearch = null;
    this.navSearchStyle = null;
  }
  
  init()
  {
    this.ttstb = document.getElementById('twotabsearchtextbox');
    this.navSearch = document.getElementById('nav-search');
    this.navSearchStyle = this.navSearch.style;
    
    this.ttstb.addEventListener('focus', this.scaleUp.bind(this));
    this.ttstb.addEventListener('blur', this.scaleDown.bind(this));
    document.addEventListener('keyup', this.handleEsc.bind(this));
  }
  
  handleEsc(ev)
  {
    if (ev.key === "Escape")
    {
      this.scaleDown();
    }
  }
  
  scaleUp()
  {
    this.navSearchStyle.position = 'fixed';
    this.navSearchStyle.left = '10px';
    this.navSearchStyle.right = '10px';
    this.navSearchStyle.zIndex = 100000000000;
  }
  
  scaleDown()
  {
    this.navSearchStyle.position = '';
    this.navSearchStyle.left = '';
    this.navSearchStyle.right = ''; 
    this.navSearchStyle.zIndex = '';    
  }
}

let ap = new AmazonPivot()
ap.init();