Baidu Pan WAP Hack

Prevent redirect

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

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

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name        Baidu Pan WAP Hack
// @namespace   http://rix.li/
// @description Prevent redirect
// @include     /^https?\:\/\/pan\.baidu\.com/
// @version     0.0.1
// @run-at      document-start
// @grant       none
// ==/UserScript==
window.addEventListener('beforescriptexecute', function (e) {
  injectScript(injectPlatform);
  window.removeEventListener(e.type, arguments.callee, true);
}, true);
function injectScript(fn) {
  var tag = document.createElement('script');
  var head = document.getElementsByTagName('head') [0];
  tag.appendChild(document.createTextNode(fn.toString().replace(/^function.*{|}$/g, '')));
  head.insertBefore(tag, head.firstChild);
}
function injectPlatform() {
  var fakePlatformGetter = function () {
    return 'FakeOS';
  };
  if (Object.defineProperty) {
    Object.defineProperty(navigator, 'platform', {
      get: fakePlatformGetter,
      configurable: true
    });
  } else if (Object.prototype.__defineGetter__) {
    navigator.__defineGetter__('platform', fakePlatformGetter);
  }
};