🎉 欢迎访问GreasyFork.Org 镜像站!本镜像站由公众号【爱吃馍】搭建,用于分享脚本。联系邮箱📮

Greasy fork 爱吃馍镜像

Cookie Manager

For Developers Only. Control Cookies everywhere via DevTools

Você precisará instalar uma extensão como Tampermonkey, Greasemonkey ou Violentmonkey para instalar este script.

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

Você precisará instalar uma extensão como Tampermonkey ou Violentmonkey para instalar este script.

Você precisará instalar uma extensão como Tampermonkey ou Userscripts para instalar este script.

Você precisará instalar uma extensão como o Tampermonkey para instalar este script.

Você precisará instalar um gerenciador de scripts de usuário para instalar este script.

(Eu já tenho um gerenciador de scripts de usuário, me deixe instalá-lo!)

🚀 安装遇到问题?关注公众号获取帮助

公众号二维码

扫码关注【爱吃馍】

回复【脚本】获取最新教程和防失联地址

Você precisará instalar uma extensão como o Stylus para instalar este estilo.

Você precisará instalar uma extensão como o Stylus para instalar este estilo.

Você precisará instalar uma extensão como o Stylus para instalar este estilo.

Você precisará instalar um gerenciador de estilos de usuário para instalar este estilo.

Você precisará instalar um gerenciador de estilos de usuário para instalar este estilo.

Você precisará instalar um gerenciador de estilos de usuário para instalar este estilo.

(Eu já possuo um gerenciador de estilos de usuário, me deixar fazer a instalação!)

🚀 安装遇到问题?关注公众号获取帮助

公众号二维码

扫码关注【爱吃馍】

回复【脚本】获取最新教程和防失联地址

Autor
𝖢𝖸 𝖥𝗎𝗇𝗀
Instalações hoje
0
Total de instalações
182
Avaliações
0 0 0
Versão
0.5
Criado
21/12/2022
Atualizado
10/01/2023
Tamanho
3,16 KB
Licença
MIT
Aplicável a
Todos os sites

This script, named "Cookie Manager", is a UserScript that is intended to be used by developers for managing cookies on a website via the developer console. It allows developers to get, set, and remove cookies using simple commands, as well as create new cookie "chefs" with specific parameters. It does so by injecting a proxy object, cook, into the unsafeWindow scope, which is an alias for the standard JavaScript global object window in Tampermonkey and other UserScript environments.

Here is a more detailed breakdown of the key components:

  1. @require: The script includes the library js-cookie, a powerful and easy-to-use JavaScript library that simplifies working with cookies. This library provides a simple, straightforward API for managing cookies, such as setting, getting, and deleting them.

  2. Initialization: The script immediately calls an anonymous function with the Cookies object from js-cookie as an argument. Inside this function, the get, set, and remove methods from Cookies are deconstructed and saved for later use.

  3. Chef Function: The script defines a function named chefFunc. This function is used to create new cookie "chefs", i.e., versions of the Cookies object with specific converters and attributes. This function is then bound to the Cookies object and added to the target object.

  4. Proxy Object: The script creates a Proxy object that is assigned to unsafeWindow.cook. The Proxy object intercepts and defines custom behavior for fundamental operations on the object it wraps. In this case, the Proxy is used to allow getting and setting cookies using dot notation. For example, cook.myvar = 'abc' sets a cookie named 'myvar' with a value of 'abc', and cook.myvar retrieves the value of the 'myvar' cookie.

The usage examples at the top of the script demonstrate how to use these capabilities. For example, cook.set('hello-world',100) sets a cookie named 'hello-world' with a value of 100, and cook.get('hello-world') retrieves the value of the 'hello-world' cookie.

This script is intended for use in the context of a browser's DevTools console, allowing developers to easily manage cookies on a website for development and testing purposes. It has a MIT license and is expected to be used on all HTTP and HTTPS websites.