Browse Source

Изменения от Главреда ГитЖС | Changes of GitJS Glavred

master
Главред | Glavred 3 years ago
parent
commit
31bc65dfad
7 changed files with 35 additions and 11 deletions
  1. +5
    -2
      0000
  2. +2
    -0
      base64js.min.js
  3. +0
    -7
      привет|hello.js
  4. +0
    -2
      привет|hello.череда
  5. +8
    -0
      пуск|run.js
  6. +5
    -0
      пуск|run.череда
  7. +15
    -0
      функции|functions.js

+ 5
- 2
0000 View File

@@ -1,5 +1,8 @@
Base64
1.0.0
https://git.opengamestudio.org/mahjong/base64

/привет|hello.череда
x /привет|hello.js
/base64js.min.js
x /пуск|run.js
/пуск|run.череда
x /функции|functions.js

+ 2
- 0
base64js.min.js View File

@@ -0,0 +1,2 @@
//https://github.com/beatgammit/base64-js
(function(r){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=r()}else if(typeof define==="function"&&define.amd){define([],r)}else{var e;if(typeof window!=="undefined"){e=window}else if(typeof global!=="undefined"){e=global}else if(typeof self!=="undefined"){e=self}else{e=this}e.base64js=r()}})(function(){var r,e,n;return function(){function d(a,f,i){function u(n,r){if(!f[n]){if(!a[n]){var e="function"==typeof require&&require;if(!r&&e)return e(n,!0);if(v)return v(n,!0);var t=new Error("Cannot find module '"+n+"'");throw t.code="MODULE_NOT_FOUND",t}var o=f[n]={exports:{}};a[n][0].call(o.exports,function(r){var e=a[n][1][r];return u(e||r)},o,o.exports,d,a,f,i)}return f[n].exports}for(var v="function"==typeof require&&require,r=0;r<i.length;r++)u(i[r]);return u}return d}()({"/":[function(r,e,n){"use strict";n.byteLength=f;n.toByteArray=i;n.fromByteArray=p;var u=[];var v=[];var d=typeof Uint8Array!=="undefined"?Uint8Array:Array;var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var o=0,a=t.length;o<a;++o){u[o]=t[o];v[t.charCodeAt(o)]=o}v["-".charCodeAt(0)]=62;v["_".charCodeAt(0)]=63;function c(r){var e=r.length;if(e%4>0){throw new Error("Invalid string. Length must be a multiple of 4")}var n=r.indexOf("=");if(n===-1)n=e;var t=n===e?0:4-n%4;return[n,t]}function f(r){var e=c(r);var n=e[0];var t=e[1];return(n+t)*3/4-t}function h(r,e,n){return(e+n)*3/4-n}function i(r){var e;var n=c(r);var t=n[0];var o=n[1];var a=new d(h(r,t,o));var f=0;var i=o>0?t-4:t;var u;for(u=0;u<i;u+=4){e=v[r.charCodeAt(u)]<<18|v[r.charCodeAt(u+1)]<<12|v[r.charCodeAt(u+2)]<<6|v[r.charCodeAt(u+3)];a[f++]=e>>16&255;a[f++]=e>>8&255;a[f++]=e&255}if(o===2){e=v[r.charCodeAt(u)]<<2|v[r.charCodeAt(u+1)]>>4;a[f++]=e&255}if(o===1){e=v[r.charCodeAt(u)]<<10|v[r.charCodeAt(u+1)]<<4|v[r.charCodeAt(u+2)]>>2;a[f++]=e>>8&255;a[f++]=e&255}return a}function s(r){return u[r>>18&63]+u[r>>12&63]+u[r>>6&63]+u[r&63]}function l(r,e,n){var t;var o=[];for(var a=e;a<n;a+=3){t=(r[a]<<16&16711680)+(r[a+1]<<8&65280)+(r[a+2]&255);o.push(s(t))}return o.join("")}function p(r){var e;var n=r.length;var t=n%3;var o=[];var a=16383;for(var f=0,i=n-t;f<i;f+=a){o.push(l(r,f,f+a>i?i:f+a))}if(t===1){e=r[n-1];o.push(u[e>>2]+u[e<<4&63]+"==")}else if(t===2){e=(r[n-2]<<8)+r[n-1];o.push(u[e>>10]+u[e>>4&63]+u[e<<2&63]+"=")}return o.join("")}},{}]},{},[])("/")});

+ 0
- 7
привет|hello.js View File

@@ -1,7 +0,0 @@
ПоприветствоватьМир = function()
{
console.log("Привет, мир!");
console.log("Hello, world!");
document.body.innerHTML += "<h1>Привет, мир!</h1>";
document.body.innerHTML += "<h1>Hello, world!</h1>";
};

+ 0
- 2
привет|hello.череда View File

@@ -1,2 +0,0 @@
пуск
поприветствовать мир

+ 8
- 0
пуск|run.js View File

@@ -0,0 +1,8 @@
const ИМЯ = "Base64";

УстановитьBase64JS = мир =>
{
var модуль = мир.модули.модульПоИмени(ИМЯ);
var содержимое = модуль.содержимое["/base64js.min.js"];
eval(содержимое);
};

+ 5
- 0
пуск|run.череда View File

@@ -0,0 +1,5 @@
пуск
установить Base64JS
ручной пуск
установить Base64JS

+ 15
- 0
функции|functions.js View File

@@ -0,0 +1,15 @@
//https://developer.mozilla.org/ru/docs/Web/API/WindowBase64/Base64_encoding_and_decoding
base64ЗашифроватьСтроку = строка =>
{
var байты = new TextEncoder("utf-8").encode(str);
return base64js.fromByteArray(байты);
};
base64EncodeString = base64ЗашифроватьСтроку;

base64РасшифроватьСтроку = строка =>
{
var байты = base64js.toByteArray(строка);
return new TextDecoder("utf-8").decode(байты);
};
base64DecodeString = base64РасшифроватьСтроку;

Loading…
Cancel
Save