Last active
December 21, 2020 02:50
-
-
Save Fog3211/2990b2b21712be14cb65fe6054b30f2a to your computer and use it in GitHub Desktop.
swagger自动填充token(油猴脚本)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name swagger自动填充token | |
| // @namespace http://tampermonkey.net/ | |
| // @version 0.1 | |
| // @description try to take over the world! | |
| // @author You | |
| // @match http://huce-sit.hupu.io/admin/swagger-ui.html | |
| // @grant none | |
| // ==/UserScript== | |
| (function () { | |
| 'use strict'; | |
| window.addEventListener('click', () => { | |
| const tokenInputDomList = document.querySelectorAll('input[type=text]') | |
| tokenInputDomList.forEach(element => { | |
| const ev = new Event('input', { | |
| bubbles: true | |
| }) | |
| ev.simulated = true; | |
| element.value = 'Bearer ' + localStorage.token | |
| element.dispatchEvent(ev) | |
| }) | |
| }) | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment