web_noimmersion_experiment OptOut

This script opts out of duolingo's web_noimmersion_experiment

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

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

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

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

你需要先安裝一款使用者腳本管理器擴展,比如 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);