web_noimmersion_experiment OptOut

This script opts out of duolingo's web_noimmersion_experiment

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name        web_noimmersion_experiment OptOut
// @namespace   web_noimmersion
// @include     https://www.duolingo.com/*
// @version     1
// @run-at      document-start
// @grant       none
// @description This script opts out of duolingo's web_noimmersion_experiment
// ==/UserScript==


window.addEventListener('beforescriptexecute', function(e){
//  if (document.getElementsByTagName("script")[7] == e.target){
    if (e.target.innerHTML.contains('duo.immersion_enabled = false;')){
    console.log('este es el bueno');
    eval(e.target.innerHTML.replace('duo.immersion_enabled = false;','duo.immersion_enabled = true;').replace('"web_noimmersion_experiment": true','"web_noimmersion_experiment": false'));
    e.stopPropagation();
    e.preventDefault();
    window.removeEventListener(e.type, arguments.callee, true);
  }
}, false);