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

Greasy fork 爱吃馍镜像

Cookie Manager

For Developers Only. Control Cookies everywhere via DevTools

Tendrás que instalar una extensión para tu navegador como Tampermonkey, Greasemonkey o Violentmonkey si quieres utilizar este script.

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

Necesitarás instalar una extensión como Tampermonkey o Violentmonkey para instalar este script.

Necesitarás instalar una extensión como Tampermonkey o Userscripts para instalar este script.

Necesitará instalar una extensión como Tampermonkey para instalar este script.

Necesitarás instalar una extensión para administrar scripts de usuario si quieres instalar este script.

(Ya tengo un administrador de scripts de usuario, déjame instalarlo)

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

公众号二维码

扫码关注【爱吃馍】

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

Necesitará instalar una extensión como Stylus para instalar este estilo.

Necesitará instalar una extensión como Stylus para instalar este estilo.

Necesitará instalar una extensión como Stylus para instalar este estilo.

Necesitará instalar una extensión del gestor de estilos de usuario para instalar este estilo.

Necesitará instalar una extensión del gestor de estilos de usuario para instalar este estilo.

Necesitará instalar una extensión del gestor de estilos de usuario para instalar este estilo.

(Ya tengo un administrador de estilos de usuario, déjame instalarlo)

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

公众号二维码

扫码关注【爱吃馍】

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

Autor
𝖢𝖸 𝖥𝗎𝗇𝗀
Instalaciones diarias
0
Instalaciones totales
182
Calificaciones
0 0 0
Versión
0.5
Creado
21/12/2022
Actualizado
10/01/2023
Tamaño
3.16 KB
Licencia
MIT
Funciona en
Todos los sitios

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.