shanbay word web phone optimize

优化web版本的shanbay单词在手机下的下一个按钮无法点击的问题.

目前為 2018-10-29 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         shanbay word web phone optimize
// @namespace    https://github.com/x22x22
// @version      0.1
// @description  优化web版本的shanbay单词在手机下的下一个按钮无法点击的问题.
// @author       You
// @match        https://www.shanbay.com/bdc/review/
// @grant        none
// ==/UserScript==

(function() {
  'use strict';
  let ua = navigator.userAgent.toLowerCase();
  let OLeft = 0;
  let viewWidth = window.innerWidth;
  if (/mobile|android|iphone|ipad|phone/i.test(ua) && viewWidth <= 767) {
    document.addEventListener('click', () => {
      let nextButtons = document.getElementsByClassName('continue continue-button');
      let progress = document.getElementsByClassName('row hide bottom-progress progress-box');
      if (progress && progress.length > 0) {
        progress[0].style.width = viewWidth - 120 + 'px';
      }
      if (
        nextButtons &&
        nextButtons.length > 0 &&
        (OLeft === 0 || nextButtons[0].style.left.replace('px', '') === OLeft)
      ) {
        OLeft = nextButtons[0].style.left.replace('px', '');
        nextButtons[0].style.left = OLeft - 30 + 'px';
      }
    });
  }
})();