// ==UserScript== // @name Bing disable safesearch // @namespace http://tampermonkey.net/ // @version 0.1 // @description Set off bing safesearch // @author You // @match https://www.bing.com/search?* // @match https://www.bing.com/images/search?* // @match https://www.bing.com/videos/search?* // @match https://www.bing.com/news/search?* // @icon https://www.google.com/s2/favicons?sz=64&domain=bing.com // @grant none // @run-at document-start // @downloadURL none // ==/UserScript== (function() { 'use strict'; var oldCookieGetAccess = false; if(typeof window.cookieGetAccess != "undefined") { oldCookieGetAccess = window.cookieGetAccess; } //bing overwrites document.cookie function to return "" if this variable is false window.cookieGetAccess = true; var cookies = document.cookie; window.cookieGetAccess = oldCookieGetAccess; /*if(cookies == ""){ cookies = cookieDesc.get.call(document); }*/ var SRCHHPGUSR = cookies.match(/SRCHHPGUSR[^;]*/)[0]; if(SRCHHPGUSR.includes("ADLT=") == true){ if(SRCHHPGUSR.includes("ADLT=OFF") == false){ SRCHHPGUSR = SRCHHPGUSR.replace(/ADLT=[^&]*/,"ADLT=OFF"); cookieInjection(); } else { if(performance.getEntriesByType("navigation")[0] && performance.getEntriesByType("navigation")[0].type!="reload"){ console.log("Bing disable safesearch: nothing to do!"); } } } else { SRCHHPGUSR = SRCHHPGUSR + "&ADLT=OFF"; cookieInjection(); } function cookieInjection() { document.cookie = SRCHHPGUSR+"; expires=Fri, 01 Jan 2038 00:00:00 GMT; domain=.bing.com; path =/; Secure"; location.reload(); console.log("Bing disable safesearch: done!"); } })();