“MediaWiki:Gadget-libPolyfill-crypto.randomUUID.js”的版本间的差异

来自萌娘共享
跳转至: 导航搜索
(代码变动:40592b0 - feat: 新版 polyfill 生成机制 (#410) by U:AnnAngela, co-authored-by: GH:github-actions[bot])
1个标签由机器人或全自动脚本执行的操作
(代码变动:40592b0b - feat: 新版 polyfill 生成机制 (#410) by U:AnnAngela, co-authored-by: GH:github-actions[bot])
1个标签由机器人或全自动脚本执行的操作
 
第4行: 第4行:
 
  * -------------------------------------------------------------------------
 
  * -------------------------------------------------------------------------
 
  */
 
  */
var _addText = '{{GHIACode|page=GHIA:MoegirlPediaInterfaceCodes/blob/master/src/gadgets/libPolyfill/MediaWiki:Gadget-libPolyfill-crypto.randomUUID.js|user=[[U:AnnAngela]]|co-authors=GH:github-actions[bot]|longId=40592b0b722ca3f6e5a448a8847015ae96151e5e|shortId=40592b0|summary=feat: 新版 polyfill 生成机制 (#410)|body=<nowiki>Co-authored-by: github-actions[bot] <41898282+github-actions[bot]📧users.noreply.github.com></nowiki>}}';  
+
var _addText = '{{GHIACode|page=GHIA:MoegirlPediaInterfaceCodes/blob/master/src/gadgets/libPolyfill/MediaWiki:Gadget-libPolyfill-crypto.randomUUID.js|user=[[U:AnnAngela]]|co-authors=GH:github-actions[bot]|longId=40592b0b722ca3f6e5a448a8847015ae96151e5e|shortId=40592b0b|summary=feat: 新版 polyfill 生成机制 (#410)|body=<nowiki>Co-authored-by: github-actions[bot] <41898282+github-actions[bot]📧users.noreply.github.com></nowiki>}}';  
  
 
/* <pre> */
 
/* <pre> */

2024年4月16日 (二) 09:03的最新版本

/**
 * -------------------------------------------------------------------------
 * !!! DON'T MODIFY THIS PAGE MANUALLY, YOUR CHANGES WILL BE OVERWRITTEN !!!
 * -------------------------------------------------------------------------
 */
var _addText = '{{GHIACode|page=GHIA:MoegirlPediaInterfaceCodes/blob/master/src/gadgets/libPolyfill/MediaWiki:Gadget-libPolyfill-crypto.randomUUID.js|user=[[U:AnnAngela]]|co-authors=GH:github-actions[bot]|longId=40592b0b722ca3f6e5a448a8847015ae96151e5e|shortId=40592b0b|summary=feat: 新版 polyfill 生成机制 (#410)|body=<nowiki>Co-authored-by: github-actions[bot] <41898282+github-actions[bot]📧users.noreply.github.com></nowiki>}}'; 

/* <pre> */

"use strict";
(function () {
    var REGEX = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
    var validate = function (uuid) { return "string" === typeof uuid && REGEX.test(uuid); };
    var rnds8 = new Uint8Array(16);
    var rng = function () { return crypto.getRandomValues(rnds8); };
    var byteToHex = [];
    for (var i = 0; i < 256; ++i) {
        byteToHex.push((i + 256).toString(16).substring(1));
    }
    var unsafeStringify = function (arr, offset) {
        if (offset === void 0) { offset = 0; }
        return "".concat(byteToHex[arr[offset + 0]]).concat(byteToHex[arr[offset + 1]]).concat(byteToHex[arr[offset + 2]]).concat(byteToHex[arr[offset + 3]], "-").concat(byteToHex[arr[offset + 4]]).concat(byteToHex[arr[offset + 5]], "-").concat(byteToHex[arr[offset + 6]]).concat(byteToHex[arr[offset + 7]], "-").concat(byteToHex[arr[offset + 8]]).concat(byteToHex[arr[offset + 9]], "-").concat(byteToHex[arr[offset + 10]]).concat(byteToHex[arr[offset + 11]]).concat(byteToHex[arr[offset + 12]]).concat(byteToHex[arr[offset + 13]]).concat(byteToHex[arr[offset + 14]]).concat(byteToHex[arr[offset + 15]]).toLowerCase();
    };
    var v4 = function (options, buf, offset) {
        if (options === void 0) { options = {}; }
        if (offset === void 0) { offset = 0; }
        var rnds = options.random || (options.rng || rng)();
        rnds[6] = rnds[6] & 0x0f | 0x40;
        rnds[8] = rnds[8] & 0x3f | 0x80;
        if (buf) {
            for (var i = 0; i < 16; ++i) {
                buf[offset + i] = rnds[i];
            }
            return buf;
        }
        return unsafeStringify(rnds);
    };
    try {
        if (!validate(crypto.randomUUID())) {
            throw void 0;
        }
    }
    catch (_a) {
        crypto.randomUUID = function () { return v4(); };
    }
})(); 

/* </pre> */