模板继承
This commit is contained in:
parent
8af8295fa2
commit
3188d19cc2
1
go.mod
1
go.mod
@ -21,6 +21,7 @@ require (
|
||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/pelletier/go-toml/v2 v2.0.1 // indirect
|
||||
github.com/stretchr/testify v1.8.0 // indirect
|
||||
github.com/ugorji/go/codec v1.2.7 // indirect
|
||||
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 // indirect
|
||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110 // indirect
|
||||
|
14
middleware/cache.go
Normal file
14
middleware/cache.go
Normal file
@ -0,0 +1,14 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"github/fthvgb1/wp-go/helper"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func SetStaticFileCache(c *gin.Context) {
|
||||
f := strings.Split(strings.TrimLeft(c.FullPath(), "/"), "/")
|
||||
if len(f) > 1 && helper.IsContainInArr(f[0], []string{"wp-includes", "wp-content"}) {
|
||||
c.Header("Cache-Control", "private, max-age=86400")
|
||||
}
|
||||
}
|
@ -2,11 +2,62 @@ package route
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"github/fthvgb1/wp-go/models"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"sync"
|
||||
)
|
||||
|
||||
var PostsCache sync.Map
|
||||
|
||||
func index(c *gin.Context) {
|
||||
page := 1
|
||||
pageSize := 10
|
||||
p := c.Query("paged")
|
||||
if pa, err := strconv.Atoi(p); err != nil {
|
||||
page = pa
|
||||
}
|
||||
status := []interface{}{"publish", "private"}
|
||||
posts, _, err := models.SimplePagination[models.WpPosts](models.SqlBuilder{{
|
||||
"post_type", "post",
|
||||
}, {"post_status", "in", ""}}, "ID", page, pageSize, models.SqlBuilder{{"post_date", "desc"}}, nil, status)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var all []uint64
|
||||
var allPosts []models.WpPosts
|
||||
var needQuery []interface{}
|
||||
for _, wpPosts := range posts {
|
||||
all = append(all, wpPosts.Id)
|
||||
if _, ok := PostsCache.Load(wpPosts.Id); !ok {
|
||||
needQuery = append(needQuery, wpPosts.Id)
|
||||
}
|
||||
}
|
||||
if len(needQuery) > 0 {
|
||||
rawPosts, err := models.Find[models.WpPosts](models.SqlBuilder{{
|
||||
"Id", "in", "",
|
||||
}}, "a.*,d.name category_name", nil, models.SqlBuilder{{
|
||||
"a", "left join", "wp_term_relationships b", "a.Id=b.object_id",
|
||||
}, {
|
||||
"left join", "wp_term_taxonomy c", "b.term_taxonomy_id=c.term_taxonomy_id",
|
||||
}, {
|
||||
"left join", "wp_terms d", "c.term_id=d.term_id",
|
||||
}}, 0, needQuery)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
for _, post := range rawPosts {
|
||||
PostsCache.Store(post.Id, post)
|
||||
}
|
||||
}
|
||||
|
||||
for _, id := range all {
|
||||
post, _ := PostsCache.Load(id)
|
||||
pp := post.(models.WpPosts)
|
||||
allPosts = append(allPosts, pp)
|
||||
}
|
||||
c.HTML(http.StatusOK, "index.html", gin.H{
|
||||
"title": "Main website",
|
||||
"posts": allPosts,
|
||||
"options": models.Options,
|
||||
})
|
||||
}
|
||||
|
@ -2,38 +2,35 @@ package route
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"github/fthvgb1/wp-go/helper"
|
||||
"github/fthvgb1/wp-go/middleware"
|
||||
"github/fthvgb1/wp-go/static"
|
||||
"html/template"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
func SetupRouter() *gin.Engine {
|
||||
// Disable Console Color
|
||||
// gin.DisableConsoleColor()
|
||||
r := gin.Default()
|
||||
r.Use(setStaticFileCache)
|
||||
r.SetFuncMap(template.FuncMap{"unescaped": func(s string) interface{} {
|
||||
r.Use(middleware.SetStaticFileCache)
|
||||
r.SetFuncMap(template.FuncMap{
|
||||
"unescaped": func(s string) interface{} {
|
||||
return template.HTML(s)
|
||||
}})
|
||||
},
|
||||
"dateCh": func(t time.Time) interface{} {
|
||||
return t.Format("2006年01月02日")
|
||||
},
|
||||
})
|
||||
f := static.Fs{FS: static.FsEx, Path: "wp-includes"}
|
||||
r.StaticFS("/wp-includes", http.FS(f))
|
||||
r.StaticFS("/wp-content", http.FS(static.Fs{
|
||||
FS: static.FsEx,
|
||||
Path: "wp-content",
|
||||
}))
|
||||
r.LoadHTMLGlob("templates/*")
|
||||
|
||||
r.LoadHTMLGlob("templates/**/*")
|
||||
// Ping test
|
||||
r.GET("/", index)
|
||||
|
||||
return r
|
||||
}
|
||||
|
||||
func setStaticFileCache(c *gin.Context) {
|
||||
f := strings.Split(strings.TrimLeft(c.FullPath(), "/"), "/")
|
||||
if len(f) > 1 && helper.IsContainInArr(f[0], []string{"wp-includes", "wp-content"}) {
|
||||
c.Header("Cache-Control", "private, max-age=86400")
|
||||
}
|
||||
}
|
||||
|
17209
static/wp-includes/js/dist/vendor/lodash.js
vendored
Executable file
17209
static/wp-includes/js/dist/vendor/lodash.js
vendored
Executable file
File diff suppressed because it is too large
Load Diff
9
static/wp-includes/js/dist/vendor/lodash.min.js
vendored
Executable file
9
static/wp-includes/js/dist/vendor/lodash.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
5685
static/wp-includes/js/dist/vendor/moment.js
vendored
Executable file
5685
static/wp-includes/js/dist/vendor/moment.js
vendored
Executable file
File diff suppressed because it is too large
Load Diff
1
static/wp-includes/js/dist/vendor/moment.min.js
vendored
Executable file
1
static/wp-includes/js/dist/vendor/moment.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
26292
static/wp-includes/js/dist/vendor/react-dom.js
vendored
Executable file
26292
static/wp-includes/js/dist/vendor/react-dom.js
vendored
Executable file
File diff suppressed because it is too large
Load Diff
9
static/wp-includes/js/dist/vendor/react-dom.min.js
vendored
Executable file
9
static/wp-includes/js/dist/vendor/react-dom.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
3357
static/wp-includes/js/dist/vendor/react.js
vendored
Executable file
3357
static/wp-includes/js/dist/vendor/react.js
vendored
Executable file
File diff suppressed because it is too large
Load Diff
9
static/wp-includes/js/dist/vendor/react.min.js
vendored
Executable file
9
static/wp-includes/js/dist/vendor/react.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
754
static/wp-includes/js/dist/vendor/regenerator-runtime.js
vendored
Executable file
754
static/wp-includes/js/dist/vendor/regenerator-runtime.js
vendored
Executable file
@ -0,0 +1,754 @@
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
var runtime = (function (exports) {
|
||||
"use strict";
|
||||
|
||||
var Op = Object.prototype;
|
||||
var hasOwn = Op.hasOwnProperty;
|
||||
var undefined; // More compressible than void 0.
|
||||
var $Symbol = typeof Symbol === "function" ? Symbol : {};
|
||||
var iteratorSymbol = $Symbol.iterator || "@@iterator";
|
||||
var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
|
||||
var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
||||
|
||||
function define(obj, key, value) {
|
||||
Object.defineProperty(obj, key, {
|
||||
value: value,
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true
|
||||
});
|
||||
return obj[key];
|
||||
}
|
||||
try {
|
||||
// IE 8 has a broken Object.defineProperty that only works on DOM objects.
|
||||
define({}, "");
|
||||
} catch (err) {
|
||||
define = function(obj, key, value) {
|
||||
return obj[key] = value;
|
||||
};
|
||||
}
|
||||
|
||||
function wrap(innerFn, outerFn, self, tryLocsList) {
|
||||
// If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
|
||||
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
|
||||
var generator = Object.create(protoGenerator.prototype);
|
||||
var context = new Context(tryLocsList || []);
|
||||
|
||||
// The ._invoke method unifies the implementations of the .next,
|
||||
// .throw, and .return methods.
|
||||
generator._invoke = makeInvokeMethod(innerFn, self, context);
|
||||
|
||||
return generator;
|
||||
}
|
||||
exports.wrap = wrap;
|
||||
|
||||
// Try/catch helper to minimize deoptimizations. Returns a completion
|
||||
// record like context.tryEntries[i].completion. This interface could
|
||||
// have been (and was previously) designed to take a closure to be
|
||||
// invoked without arguments, but in all the cases we care about we
|
||||
// already have an existing method we want to call, so there's no need
|
||||
// to create a new function object. We can even get away with assuming
|
||||
// the method takes exactly one argument, since that happens to be true
|
||||
// in every case, so we don't have to touch the arguments object. The
|
||||
// only additional allocation required is the completion record, which
|
||||
// has a stable shape and so hopefully should be cheap to allocate.
|
||||
function tryCatch(fn, obj, arg) {
|
||||
try {
|
||||
return { type: "normal", arg: fn.call(obj, arg) };
|
||||
} catch (err) {
|
||||
return { type: "throw", arg: err };
|
||||
}
|
||||
}
|
||||
|
||||
var GenStateSuspendedStart = "suspendedStart";
|
||||
var GenStateSuspendedYield = "suspendedYield";
|
||||
var GenStateExecuting = "executing";
|
||||
var GenStateCompleted = "completed";
|
||||
|
||||
// Returning this object from the innerFn has the same effect as
|
||||
// breaking out of the dispatch switch statement.
|
||||
var ContinueSentinel = {};
|
||||
|
||||
// Dummy constructor functions that we use as the .constructor and
|
||||
// .constructor.prototype properties for functions that return Generator
|
||||
// objects. For full spec compliance, you may wish to configure your
|
||||
// minifier not to mangle the names of these two functions.
|
||||
function Generator() {}
|
||||
function GeneratorFunction() {}
|
||||
function GeneratorFunctionPrototype() {}
|
||||
|
||||
// This is a polyfill for %IteratorPrototype% for environments that
|
||||
// don't natively support it.
|
||||
var IteratorPrototype = {};
|
||||
define(IteratorPrototype, iteratorSymbol, function () {
|
||||
return this;
|
||||
});
|
||||
|
||||
var getProto = Object.getPrototypeOf;
|
||||
var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
||||
if (NativeIteratorPrototype &&
|
||||
NativeIteratorPrototype !== Op &&
|
||||
hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
|
||||
// This environment has a native %IteratorPrototype%; use it instead
|
||||
// of the polyfill.
|
||||
IteratorPrototype = NativeIteratorPrototype;
|
||||
}
|
||||
|
||||
var Gp = GeneratorFunctionPrototype.prototype =
|
||||
Generator.prototype = Object.create(IteratorPrototype);
|
||||
GeneratorFunction.prototype = GeneratorFunctionPrototype;
|
||||
define(Gp, "constructor", GeneratorFunctionPrototype);
|
||||
define(GeneratorFunctionPrototype, "constructor", GeneratorFunction);
|
||||
GeneratorFunction.displayName = define(
|
||||
GeneratorFunctionPrototype,
|
||||
toStringTagSymbol,
|
||||
"GeneratorFunction"
|
||||
);
|
||||
|
||||
// Helper for defining the .next, .throw, and .return methods of the
|
||||
// Iterator interface in terms of a single ._invoke method.
|
||||
function defineIteratorMethods(prototype) {
|
||||
["next", "throw", "return"].forEach(function(method) {
|
||||
define(prototype, method, function(arg) {
|
||||
return this._invoke(method, arg);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
exports.isGeneratorFunction = function(genFun) {
|
||||
var ctor = typeof genFun === "function" && genFun.constructor;
|
||||
return ctor
|
||||
? ctor === GeneratorFunction ||
|
||||
// For the native GeneratorFunction constructor, the best we can
|
||||
// do is to check its .name property.
|
||||
(ctor.displayName || ctor.name) === "GeneratorFunction"
|
||||
: false;
|
||||
};
|
||||
|
||||
exports.mark = function(genFun) {
|
||||
if (Object.setPrototypeOf) {
|
||||
Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
|
||||
} else {
|
||||
genFun.__proto__ = GeneratorFunctionPrototype;
|
||||
define(genFun, toStringTagSymbol, "GeneratorFunction");
|
||||
}
|
||||
genFun.prototype = Object.create(Gp);
|
||||
return genFun;
|
||||
};
|
||||
|
||||
// Within the body of any async function, `await x` is transformed to
|
||||
// `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
|
||||
// `hasOwn.call(value, "__await")` to determine if the yielded value is
|
||||
// meant to be awaited.
|
||||
exports.awrap = function(arg) {
|
||||
return { __await: arg };
|
||||
};
|
||||
|
||||
function AsyncIterator(generator, PromiseImpl) {
|
||||
function invoke(method, arg, resolve, reject) {
|
||||
var record = tryCatch(generator[method], generator, arg);
|
||||
if (record.type === "throw") {
|
||||
reject(record.arg);
|
||||
} else {
|
||||
var result = record.arg;
|
||||
var value = result.value;
|
||||
if (value &&
|
||||
typeof value === "object" &&
|
||||
hasOwn.call(value, "__await")) {
|
||||
return PromiseImpl.resolve(value.__await).then(function(value) {
|
||||
invoke("next", value, resolve, reject);
|
||||
}, function(err) {
|
||||
invoke("throw", err, resolve, reject);
|
||||
});
|
||||
}
|
||||
|
||||
return PromiseImpl.resolve(value).then(function(unwrapped) {
|
||||
// When a yielded Promise is resolved, its final value becomes
|
||||
// the .value of the Promise<{value,done}> result for the
|
||||
// current iteration.
|
||||
result.value = unwrapped;
|
||||
resolve(result);
|
||||
}, function(error) {
|
||||
// If a rejected Promise was yielded, throw the rejection back
|
||||
// into the async generator function so it can be handled there.
|
||||
return invoke("throw", error, resolve, reject);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
var previousPromise;
|
||||
|
||||
function enqueue(method, arg) {
|
||||
function callInvokeWithMethodAndArg() {
|
||||
return new PromiseImpl(function(resolve, reject) {
|
||||
invoke(method, arg, resolve, reject);
|
||||
});
|
||||
}
|
||||
|
||||
return previousPromise =
|
||||
// If enqueue has been called before, then we want to wait until
|
||||
// all previous Promises have been resolved before calling invoke,
|
||||
// so that results are always delivered in the correct order. If
|
||||
// enqueue has not been called before, then it is important to
|
||||
// call invoke immediately, without waiting on a callback to fire,
|
||||
// so that the async generator function has the opportunity to do
|
||||
// any necessary setup in a predictable way. This predictability
|
||||
// is why the Promise constructor synchronously invokes its
|
||||
// executor callback, and why async functions synchronously
|
||||
// execute code before the first await. Since we implement simple
|
||||
// async functions in terms of async generators, it is especially
|
||||
// important to get this right, even though it requires care.
|
||||
previousPromise ? previousPromise.then(
|
||||
callInvokeWithMethodAndArg,
|
||||
// Avoid propagating failures to Promises returned by later
|
||||
// invocations of the iterator.
|
||||
callInvokeWithMethodAndArg
|
||||
) : callInvokeWithMethodAndArg();
|
||||
}
|
||||
|
||||
// Define the unified helper method that is used to implement .next,
|
||||
// .throw, and .return (see defineIteratorMethods).
|
||||
this._invoke = enqueue;
|
||||
}
|
||||
|
||||
defineIteratorMethods(AsyncIterator.prototype);
|
||||
define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
||||
return this;
|
||||
});
|
||||
exports.AsyncIterator = AsyncIterator;
|
||||
|
||||
// Note that simple async functions are implemented on top of
|
||||
// AsyncIterator objects; they just return a Promise for the value of
|
||||
// the final result produced by the iterator.
|
||||
exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
||||
if (PromiseImpl === void 0) PromiseImpl = Promise;
|
||||
|
||||
var iter = new AsyncIterator(
|
||||
wrap(innerFn, outerFn, self, tryLocsList),
|
||||
PromiseImpl
|
||||
);
|
||||
|
||||
return exports.isGeneratorFunction(outerFn)
|
||||
? iter // If outerFn is a generator, return the full iterator.
|
||||
: iter.next().then(function(result) {
|
||||
return result.done ? result.value : iter.next();
|
||||
});
|
||||
};
|
||||
|
||||
function makeInvokeMethod(innerFn, self, context) {
|
||||
var state = GenStateSuspendedStart;
|
||||
|
||||
return function invoke(method, arg) {
|
||||
if (state === GenStateExecuting) {
|
||||
throw new Error("Generator is already running");
|
||||
}
|
||||
|
||||
if (state === GenStateCompleted) {
|
||||
if (method === "throw") {
|
||||
throw arg;
|
||||
}
|
||||
|
||||
// Be forgiving, per 25.3.3.3.3 of the spec:
|
||||
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
|
||||
return doneResult();
|
||||
}
|
||||
|
||||
context.method = method;
|
||||
context.arg = arg;
|
||||
|
||||
while (true) {
|
||||
var delegate = context.delegate;
|
||||
if (delegate) {
|
||||
var delegateResult = maybeInvokeDelegate(delegate, context);
|
||||
if (delegateResult) {
|
||||
if (delegateResult === ContinueSentinel) continue;
|
||||
return delegateResult;
|
||||
}
|
||||
}
|
||||
|
||||
if (context.method === "next") {
|
||||
// Setting context._sent for legacy support of Babel's
|
||||
// function.sent implementation.
|
||||
context.sent = context._sent = context.arg;
|
||||
|
||||
} else if (context.method === "throw") {
|
||||
if (state === GenStateSuspendedStart) {
|
||||
state = GenStateCompleted;
|
||||
throw context.arg;
|
||||
}
|
||||
|
||||
context.dispatchException(context.arg);
|
||||
|
||||
} else if (context.method === "return") {
|
||||
context.abrupt("return", context.arg);
|
||||
}
|
||||
|
||||
state = GenStateExecuting;
|
||||
|
||||
var record = tryCatch(innerFn, self, context);
|
||||
if (record.type === "normal") {
|
||||
// If an exception is thrown from innerFn, we leave state ===
|
||||
// GenStateExecuting and loop back for another invocation.
|
||||
state = context.done
|
||||
? GenStateCompleted
|
||||
: GenStateSuspendedYield;
|
||||
|
||||
if (record.arg === ContinueSentinel) {
|
||||
continue;
|
||||
}
|
||||
|
||||
return {
|
||||
value: record.arg,
|
||||
done: context.done
|
||||
};
|
||||
|
||||
} else if (record.type === "throw") {
|
||||
state = GenStateCompleted;
|
||||
// Dispatch the exception by looping back around to the
|
||||
// context.dispatchException(context.arg) call above.
|
||||
context.method = "throw";
|
||||
context.arg = record.arg;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Call delegate.iterator[context.method](context.arg) and handle the
|
||||
// result, either by returning a { value, done } result from the
|
||||
// delegate iterator, or by modifying context.method and context.arg,
|
||||
// setting context.delegate to null, and returning the ContinueSentinel.
|
||||
function maybeInvokeDelegate(delegate, context) {
|
||||
var method = delegate.iterator[context.method];
|
||||
if (method === undefined) {
|
||||
// A .throw or .return when the delegate iterator has no .throw
|
||||
// method always terminates the yield* loop.
|
||||
context.delegate = null;
|
||||
|
||||
if (context.method === "throw") {
|
||||
// Note: ["return"] must be used for ES3 parsing compatibility.
|
||||
if (delegate.iterator["return"]) {
|
||||
// If the delegate iterator has a return method, give it a
|
||||
// chance to clean up.
|
||||
context.method = "return";
|
||||
context.arg = undefined;
|
||||
maybeInvokeDelegate(delegate, context);
|
||||
|
||||
if (context.method === "throw") {
|
||||
// If maybeInvokeDelegate(context) changed context.method from
|
||||
// "return" to "throw", let that override the TypeError below.
|
||||
return ContinueSentinel;
|
||||
}
|
||||
}
|
||||
|
||||
context.method = "throw";
|
||||
context.arg = new TypeError(
|
||||
"The iterator does not provide a 'throw' method");
|
||||
}
|
||||
|
||||
return ContinueSentinel;
|
||||
}
|
||||
|
||||
var record = tryCatch(method, delegate.iterator, context.arg);
|
||||
|
||||
if (record.type === "throw") {
|
||||
context.method = "throw";
|
||||
context.arg = record.arg;
|
||||
context.delegate = null;
|
||||
return ContinueSentinel;
|
||||
}
|
||||
|
||||
var info = record.arg;
|
||||
|
||||
if (! info) {
|
||||
context.method = "throw";
|
||||
context.arg = new TypeError("iterator result is not an object");
|
||||
context.delegate = null;
|
||||
return ContinueSentinel;
|
||||
}
|
||||
|
||||
if (info.done) {
|
||||
// Assign the result of the finished delegate to the temporary
|
||||
// variable specified by delegate.resultName (see delegateYield).
|
||||
context[delegate.resultName] = info.value;
|
||||
|
||||
// Resume execution at the desired location (see delegateYield).
|
||||
context.next = delegate.nextLoc;
|
||||
|
||||
// If context.method was "throw" but the delegate handled the
|
||||
// exception, let the outer generator proceed normally. If
|
||||
// context.method was "next", forget context.arg since it has been
|
||||
// "consumed" by the delegate iterator. If context.method was
|
||||
// "return", allow the original .return call to continue in the
|
||||
// outer generator.
|
||||
if (context.method !== "return") {
|
||||
context.method = "next";
|
||||
context.arg = undefined;
|
||||
}
|
||||
|
||||
} else {
|
||||
// Re-yield the result returned by the delegate method.
|
||||
return info;
|
||||
}
|
||||
|
||||
// The delegate iterator is finished, so forget it and continue with
|
||||
// the outer generator.
|
||||
context.delegate = null;
|
||||
return ContinueSentinel;
|
||||
}
|
||||
|
||||
// Define Generator.prototype.{next,throw,return} in terms of the
|
||||
// unified ._invoke helper method.
|
||||
defineIteratorMethods(Gp);
|
||||
|
||||
define(Gp, toStringTagSymbol, "Generator");
|
||||
|
||||
// A Generator should always return itself as the iterator object when the
|
||||
// @@iterator function is called on it. Some browsers' implementations of the
|
||||
// iterator prototype chain incorrectly implement this, causing the Generator
|
||||
// object to not be returned from this call. This ensures that doesn't happen.
|
||||
// See https://github.com/facebook/regenerator/issues/274 for more details.
|
||||
define(Gp, iteratorSymbol, function() {
|
||||
return this;
|
||||
});
|
||||
|
||||
define(Gp, "toString", function() {
|
||||
return "[object Generator]";
|
||||
});
|
||||
|
||||
function pushTryEntry(locs) {
|
||||
var entry = { tryLoc: locs[0] };
|
||||
|
||||
if (1 in locs) {
|
||||
entry.catchLoc = locs[1];
|
||||
}
|
||||
|
||||
if (2 in locs) {
|
||||
entry.finallyLoc = locs[2];
|
||||
entry.afterLoc = locs[3];
|
||||
}
|
||||
|
||||
this.tryEntries.push(entry);
|
||||
}
|
||||
|
||||
function resetTryEntry(entry) {
|
||||
var record = entry.completion || {};
|
||||
record.type = "normal";
|
||||
delete record.arg;
|
||||
entry.completion = record;
|
||||
}
|
||||
|
||||
function Context(tryLocsList) {
|
||||
// The root entry object (effectively a try statement without a catch
|
||||
// or a finally block) gives us a place to store values thrown from
|
||||
// locations where there is no enclosing try statement.
|
||||
this.tryEntries = [{ tryLoc: "root" }];
|
||||
tryLocsList.forEach(pushTryEntry, this);
|
||||
this.reset(true);
|
||||
}
|
||||
|
||||
exports.keys = function(object) {
|
||||
var keys = [];
|
||||
for (var key in object) {
|
||||
keys.push(key);
|
||||
}
|
||||
keys.reverse();
|
||||
|
||||
// Rather than returning an object with a next method, we keep
|
||||
// things simple and return the next function itself.
|
||||
return function next() {
|
||||
while (keys.length) {
|
||||
var key = keys.pop();
|
||||
if (key in object) {
|
||||
next.value = key;
|
||||
next.done = false;
|
||||
return next;
|
||||
}
|
||||
}
|
||||
|
||||
// To avoid creating an additional object, we just hang the .value
|
||||
// and .done properties off the next function object itself. This
|
||||
// also ensures that the minifier will not anonymize the function.
|
||||
next.done = true;
|
||||
return next;
|
||||
};
|
||||
};
|
||||
|
||||
function values(iterable) {
|
||||
if (iterable) {
|
||||
var iteratorMethod = iterable[iteratorSymbol];
|
||||
if (iteratorMethod) {
|
||||
return iteratorMethod.call(iterable);
|
||||
}
|
||||
|
||||
if (typeof iterable.next === "function") {
|
||||
return iterable;
|
||||
}
|
||||
|
||||
if (!isNaN(iterable.length)) {
|
||||
var i = -1, next = function next() {
|
||||
while (++i < iterable.length) {
|
||||
if (hasOwn.call(iterable, i)) {
|
||||
next.value = iterable[i];
|
||||
next.done = false;
|
||||
return next;
|
||||
}
|
||||
}
|
||||
|
||||
next.value = undefined;
|
||||
next.done = true;
|
||||
|
||||
return next;
|
||||
};
|
||||
|
||||
return next.next = next;
|
||||
}
|
||||
}
|
||||
|
||||
// Return an iterator with no values.
|
||||
return { next: doneResult };
|
||||
}
|
||||
exports.values = values;
|
||||
|
||||
function doneResult() {
|
||||
return { value: undefined, done: true };
|
||||
}
|
||||
|
||||
Context.prototype = {
|
||||
constructor: Context,
|
||||
|
||||
reset: function(skipTempReset) {
|
||||
this.prev = 0;
|
||||
this.next = 0;
|
||||
// Resetting context._sent for legacy support of Babel's
|
||||
// function.sent implementation.
|
||||
this.sent = this._sent = undefined;
|
||||
this.done = false;
|
||||
this.delegate = null;
|
||||
|
||||
this.method = "next";
|
||||
this.arg = undefined;
|
||||
|
||||
this.tryEntries.forEach(resetTryEntry);
|
||||
|
||||
if (!skipTempReset) {
|
||||
for (var name in this) {
|
||||
// Not sure about the optimal order of these conditions:
|
||||
if (name.charAt(0) === "t" &&
|
||||
hasOwn.call(this, name) &&
|
||||
!isNaN(+name.slice(1))) {
|
||||
this[name] = undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
stop: function() {
|
||||
this.done = true;
|
||||
|
||||
var rootEntry = this.tryEntries[0];
|
||||
var rootRecord = rootEntry.completion;
|
||||
if (rootRecord.type === "throw") {
|
||||
throw rootRecord.arg;
|
||||
}
|
||||
|
||||
return this.rval;
|
||||
},
|
||||
|
||||
dispatchException: function(exception) {
|
||||
if (this.done) {
|
||||
throw exception;
|
||||
}
|
||||
|
||||
var context = this;
|
||||
function handle(loc, caught) {
|
||||
record.type = "throw";
|
||||
record.arg = exception;
|
||||
context.next = loc;
|
||||
|
||||
if (caught) {
|
||||
// If the dispatched exception was caught by a catch block,
|
||||
// then let that catch block handle the exception normally.
|
||||
context.method = "next";
|
||||
context.arg = undefined;
|
||||
}
|
||||
|
||||
return !! caught;
|
||||
}
|
||||
|
||||
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
||||
var entry = this.tryEntries[i];
|
||||
var record = entry.completion;
|
||||
|
||||
if (entry.tryLoc === "root") {
|
||||
// Exception thrown outside of any try block that could handle
|
||||
// it, so set the completion value of the entire function to
|
||||
// throw the exception.
|
||||
return handle("end");
|
||||
}
|
||||
|
||||
if (entry.tryLoc <= this.prev) {
|
||||
var hasCatch = hasOwn.call(entry, "catchLoc");
|
||||
var hasFinally = hasOwn.call(entry, "finallyLoc");
|
||||
|
||||
if (hasCatch && hasFinally) {
|
||||
if (this.prev < entry.catchLoc) {
|
||||
return handle(entry.catchLoc, true);
|
||||
} else if (this.prev < entry.finallyLoc) {
|
||||
return handle(entry.finallyLoc);
|
||||
}
|
||||
|
||||
} else if (hasCatch) {
|
||||
if (this.prev < entry.catchLoc) {
|
||||
return handle(entry.catchLoc, true);
|
||||
}
|
||||
|
||||
} else if (hasFinally) {
|
||||
if (this.prev < entry.finallyLoc) {
|
||||
return handle(entry.finallyLoc);
|
||||
}
|
||||
|
||||
} else {
|
||||
throw new Error("try statement without catch or finally");
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
abrupt: function(type, arg) {
|
||||
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
||||
var entry = this.tryEntries[i];
|
||||
if (entry.tryLoc <= this.prev &&
|
||||
hasOwn.call(entry, "finallyLoc") &&
|
||||
this.prev < entry.finallyLoc) {
|
||||
var finallyEntry = entry;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (finallyEntry &&
|
||||
(type === "break" ||
|
||||
type === "continue") &&
|
||||
finallyEntry.tryLoc <= arg &&
|
||||
arg <= finallyEntry.finallyLoc) {
|
||||
// Ignore the finally entry if control is not jumping to a
|
||||
// location outside the try/catch block.
|
||||
finallyEntry = null;
|
||||
}
|
||||
|
||||
var record = finallyEntry ? finallyEntry.completion : {};
|
||||
record.type = type;
|
||||
record.arg = arg;
|
||||
|
||||
if (finallyEntry) {
|
||||
this.method = "next";
|
||||
this.next = finallyEntry.finallyLoc;
|
||||
return ContinueSentinel;
|
||||
}
|
||||
|
||||
return this.complete(record);
|
||||
},
|
||||
|
||||
complete: function(record, afterLoc) {
|
||||
if (record.type === "throw") {
|
||||
throw record.arg;
|
||||
}
|
||||
|
||||
if (record.type === "break" ||
|
||||
record.type === "continue") {
|
||||
this.next = record.arg;
|
||||
} else if (record.type === "return") {
|
||||
this.rval = this.arg = record.arg;
|
||||
this.method = "return";
|
||||
this.next = "end";
|
||||
} else if (record.type === "normal" && afterLoc) {
|
||||
this.next = afterLoc;
|
||||
}
|
||||
|
||||
return ContinueSentinel;
|
||||
},
|
||||
|
||||
finish: function(finallyLoc) {
|
||||
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
||||
var entry = this.tryEntries[i];
|
||||
if (entry.finallyLoc === finallyLoc) {
|
||||
this.complete(entry.completion, entry.afterLoc);
|
||||
resetTryEntry(entry);
|
||||
return ContinueSentinel;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"catch": function(tryLoc) {
|
||||
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
||||
var entry = this.tryEntries[i];
|
||||
if (entry.tryLoc === tryLoc) {
|
||||
var record = entry.completion;
|
||||
if (record.type === "throw") {
|
||||
var thrown = record.arg;
|
||||
resetTryEntry(entry);
|
||||
}
|
||||
return thrown;
|
||||
}
|
||||
}
|
||||
|
||||
// The context.catch method must only be called with a location
|
||||
// argument that corresponds to a known catch block.
|
||||
throw new Error("illegal catch attempt");
|
||||
},
|
||||
|
||||
delegateYield: function(iterable, resultName, nextLoc) {
|
||||
this.delegate = {
|
||||
iterator: values(iterable),
|
||||
resultName: resultName,
|
||||
nextLoc: nextLoc
|
||||
};
|
||||
|
||||
if (this.method === "next") {
|
||||
// Deliberately forget the last sent value so that we don't
|
||||
// accidentally pass it on to the delegate.
|
||||
this.arg = undefined;
|
||||
}
|
||||
|
||||
return ContinueSentinel;
|
||||
}
|
||||
};
|
||||
|
||||
// Regardless of whether this script is executing as a CommonJS module
|
||||
// or not, return the runtime object so that we can declare the variable
|
||||
// regeneratorRuntime in the outer scope, which allows this module to be
|
||||
// injected easily by `bin/regenerator --include-runtime script.js`.
|
||||
return exports;
|
||||
|
||||
}(
|
||||
// If this script is executing as a CommonJS module, use module.exports
|
||||
// as the regeneratorRuntime namespace. Otherwise create a new empty
|
||||
// object. Either way, the resulting object will be used to initialize
|
||||
// the regeneratorRuntime variable at the top of this file.
|
||||
typeof module === "object" ? module.exports : {}
|
||||
));
|
||||
|
||||
try {
|
||||
regeneratorRuntime = runtime;
|
||||
} catch (accidentalStrictMode) {
|
||||
// This module should not be running in strict mode, so the above
|
||||
// assignment should always work unless something is misconfigured. Just
|
||||
// in case runtime.js accidentally runs in strict mode, in modern engines
|
||||
// we can explicitly access globalThis. In older engines we can escape
|
||||
// strict mode using a global Function call. This could conceivably fail
|
||||
// if a Content Security Policy forbids using Function, but in that case
|
||||
// the proper solution is to fix the accidental strict mode problem. If
|
||||
// you've misconfigured your bundler to force strict mode and applied a
|
||||
// CSP to forbid Function, and you're not willing to fix either of those
|
||||
// problems, please detail your unique predicament in a GitHub issue.
|
||||
if (typeof globalThis === "object") {
|
||||
globalThis.regeneratorRuntime = runtime;
|
||||
} else {
|
||||
Function("r", "regeneratorRuntime = r")(runtime);
|
||||
}
|
||||
}
|
1
static/wp-includes/js/dist/vendor/regenerator-runtime.min.js
vendored
Executable file
1
static/wp-includes/js/dist/vendor/regenerator-runtime.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
101
static/wp-includes/js/dist/vendor/wp-polyfill-dom-rect.js
vendored
Executable file
101
static/wp-includes/js/dist/vendor/wp-polyfill-dom-rect.js
vendored
Executable file
@ -0,0 +1,101 @@
|
||||
|
||||
// DOMRect
|
||||
(function (global) {
|
||||
function number(v) {
|
||||
return v === undefined ? 0 : Number(v);
|
||||
}
|
||||
|
||||
function different(u, v) {
|
||||
return u !== v && !(isNaN(u) && isNaN(v));
|
||||
}
|
||||
|
||||
function DOMRect(xArg, yArg, wArg, hArg) {
|
||||
var x, y, width, height, left, right, top, bottom;
|
||||
|
||||
x = number(xArg);
|
||||
y = number(yArg);
|
||||
width = number(wArg);
|
||||
height = number(hArg);
|
||||
|
||||
Object.defineProperties(this, {
|
||||
x: {
|
||||
get: function () { return x; },
|
||||
set: function (newX) {
|
||||
if (different(x, newX)) {
|
||||
x = newX;
|
||||
left = right = undefined;
|
||||
}
|
||||
},
|
||||
enumerable: true
|
||||
},
|
||||
y: {
|
||||
get: function () { return y; },
|
||||
set: function (newY) {
|
||||
if (different(y, newY)) {
|
||||
y = newY;
|
||||
top = bottom = undefined;
|
||||
}
|
||||
},
|
||||
enumerable: true
|
||||
},
|
||||
width: {
|
||||
get: function () { return width; },
|
||||
set: function (newWidth) {
|
||||
if (different(width, newWidth)) {
|
||||
width = newWidth;
|
||||
left = right = undefined;
|
||||
}
|
||||
},
|
||||
enumerable: true
|
||||
},
|
||||
height: {
|
||||
get: function () { return height; },
|
||||
set: function (newHeight) {
|
||||
if (different(height, newHeight)) {
|
||||
height = newHeight;
|
||||
top = bottom = undefined;
|
||||
}
|
||||
},
|
||||
enumerable: true
|
||||
},
|
||||
left: {
|
||||
get: function () {
|
||||
if (left === undefined) {
|
||||
left = x + Math.min(0, width);
|
||||
}
|
||||
return left;
|
||||
},
|
||||
enumerable: true
|
||||
},
|
||||
right: {
|
||||
get: function () {
|
||||
if (right === undefined) {
|
||||
right = x + Math.max(0, width);
|
||||
}
|
||||
return right;
|
||||
},
|
||||
enumerable: true
|
||||
},
|
||||
top: {
|
||||
get: function () {
|
||||
if (top === undefined) {
|
||||
top = y + Math.min(0, height);
|
||||
}
|
||||
return top;
|
||||
},
|
||||
enumerable: true
|
||||
},
|
||||
bottom: {
|
||||
get: function () {
|
||||
if (bottom === undefined) {
|
||||
bottom = y + Math.max(0, height);
|
||||
}
|
||||
return bottom;
|
||||
},
|
||||
enumerable: true
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
global.DOMRect = DOMRect;
|
||||
}(self));
|
1
static/wp-includes/js/dist/vendor/wp-polyfill-dom-rect.min.js
vendored
Executable file
1
static/wp-includes/js/dist/vendor/wp-polyfill-dom-rect.min.js
vendored
Executable file
@ -0,0 +1 @@
|
||||
!function(){function e(e){return void 0===e?0:Number(e)}function n(e,n){return!(e===n||isNaN(e)&&isNaN(n))}self.DOMRect=function(t,i,u,r){var o,f,c,a,m=e(t),b=e(i),d=e(u),g=e(r);Object.defineProperties(this,{x:{get:function(){return m},set:function(e){n(m,e)&&(m=e,o=f=void 0)},enumerable:!0},y:{get:function(){return b},set:function(e){n(b,e)&&(b=e,c=a=void 0)},enumerable:!0},width:{get:function(){return d},set:function(e){n(d,e)&&(d=e,o=f=void 0)},enumerable:!0},height:{get:function(){return g},set:function(e){n(g,e)&&(g=e,c=a=void 0)},enumerable:!0},left:{get:function(){return o=void 0===o?m+Math.min(0,d):o},enumerable:!0},right:{get:function(){return f=void 0===f?m+Math.max(0,d):f},enumerable:!0},top:{get:function(){return c=void 0===c?b+Math.min(0,g):c},enumerable:!0},bottom:{get:function(){return a=void 0===a?b+Math.max(0,g):a},enumerable:!0}})}}();
|
33
static/wp-includes/js/dist/vendor/wp-polyfill-element-closest.js
vendored
Executable file
33
static/wp-includes/js/dist/vendor/wp-polyfill-element-closest.js
vendored
Executable file
@ -0,0 +1,33 @@
|
||||
// element-closest | CC0-1.0 | github.com/jonathantneal/closest
|
||||
|
||||
(function (ElementProto) {
|
||||
if (typeof ElementProto.matches !== 'function') {
|
||||
ElementProto.matches = ElementProto.msMatchesSelector || ElementProto.mozMatchesSelector || ElementProto.webkitMatchesSelector || function matches(selector) {
|
||||
var element = this;
|
||||
var elements = (element.document || element.ownerDocument).querySelectorAll(selector);
|
||||
var index = 0;
|
||||
|
||||
while (elements[index] && elements[index] !== element) {
|
||||
++index;
|
||||
}
|
||||
|
||||
return Boolean(elements[index]);
|
||||
};
|
||||
}
|
||||
|
||||
if (typeof ElementProto.closest !== 'function') {
|
||||
ElementProto.closest = function closest(selector) {
|
||||
var element = this;
|
||||
|
||||
while (element && element.nodeType === 1) {
|
||||
if (element.matches(selector)) {
|
||||
return element;
|
||||
}
|
||||
|
||||
element = element.parentNode;
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
}
|
||||
})(window.Element.prototype);
|
1
static/wp-includes/js/dist/vendor/wp-polyfill-element-closest.min.js
vendored
Executable file
1
static/wp-includes/js/dist/vendor/wp-polyfill-element-closest.min.js
vendored
Executable file
@ -0,0 +1 @@
|
||||
!function(e){"function"!=typeof e.matches&&(e.matches=e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||function(e){for(var t=this,o=(t.document||t.ownerDocument).querySelectorAll(e),n=0;o[n]&&o[n]!==t;)++n;return Boolean(o[n])}),"function"!=typeof e.closest&&(e.closest=function(e){for(var t=this;t&&1===t.nodeType;){if(t.matches(e))return t;t=t.parentNode}return null})}(window.Element.prototype);
|
620
static/wp-includes/js/dist/vendor/wp-polyfill-fetch.js
vendored
Executable file
620
static/wp-includes/js/dist/vendor/wp-polyfill-fetch.js
vendored
Executable file
@ -0,0 +1,620 @@
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
||||
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
||||
(factory((global.WHATWGFetch = {})));
|
||||
}(this, (function (exports) { 'use strict';
|
||||
|
||||
var global =
|
||||
(typeof globalThis !== 'undefined' && globalThis) ||
|
||||
(typeof self !== 'undefined' && self) ||
|
||||
(typeof global !== 'undefined' && global);
|
||||
|
||||
var support = {
|
||||
searchParams: 'URLSearchParams' in global,
|
||||
iterable: 'Symbol' in global && 'iterator' in Symbol,
|
||||
blob:
|
||||
'FileReader' in global &&
|
||||
'Blob' in global &&
|
||||
(function() {
|
||||
try {
|
||||
new Blob();
|
||||
return true
|
||||
} catch (e) {
|
||||
return false
|
||||
}
|
||||
})(),
|
||||
formData: 'FormData' in global,
|
||||
arrayBuffer: 'ArrayBuffer' in global
|
||||
};
|
||||
|
||||
function isDataView(obj) {
|
||||
return obj && DataView.prototype.isPrototypeOf(obj)
|
||||
}
|
||||
|
||||
if (support.arrayBuffer) {
|
||||
var viewClasses = [
|
||||
'[object Int8Array]',
|
||||
'[object Uint8Array]',
|
||||
'[object Uint8ClampedArray]',
|
||||
'[object Int16Array]',
|
||||
'[object Uint16Array]',
|
||||
'[object Int32Array]',
|
||||
'[object Uint32Array]',
|
||||
'[object Float32Array]',
|
||||
'[object Float64Array]'
|
||||
];
|
||||
|
||||
var isArrayBufferView =
|
||||
ArrayBuffer.isView ||
|
||||
function(obj) {
|
||||
return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1
|
||||
};
|
||||
}
|
||||
|
||||
function normalizeName(name) {
|
||||
if (typeof name !== 'string') {
|
||||
name = String(name);
|
||||
}
|
||||
if (/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(name) || name === '') {
|
||||
throw new TypeError('Invalid character in header field name: "' + name + '"')
|
||||
}
|
||||
return name.toLowerCase()
|
||||
}
|
||||
|
||||
function normalizeValue(value) {
|
||||
if (typeof value !== 'string') {
|
||||
value = String(value);
|
||||
}
|
||||
return value
|
||||
}
|
||||
|
||||
// Build a destructive iterator for the value list
|
||||
function iteratorFor(items) {
|
||||
var iterator = {
|
||||
next: function() {
|
||||
var value = items.shift();
|
||||
return {done: value === undefined, value: value}
|
||||
}
|
||||
};
|
||||
|
||||
if (support.iterable) {
|
||||
iterator[Symbol.iterator] = function() {
|
||||
return iterator
|
||||
};
|
||||
}
|
||||
|
||||
return iterator
|
||||
}
|
||||
|
||||
function Headers(headers) {
|
||||
this.map = {};
|
||||
|
||||
if (headers instanceof Headers) {
|
||||
headers.forEach(function(value, name) {
|
||||
this.append(name, value);
|
||||
}, this);
|
||||
} else if (Array.isArray(headers)) {
|
||||
headers.forEach(function(header) {
|
||||
this.append(header[0], header[1]);
|
||||
}, this);
|
||||
} else if (headers) {
|
||||
Object.getOwnPropertyNames(headers).forEach(function(name) {
|
||||
this.append(name, headers[name]);
|
||||
}, this);
|
||||
}
|
||||
}
|
||||
|
||||
Headers.prototype.append = function(name, value) {
|
||||
name = normalizeName(name);
|
||||
value = normalizeValue(value);
|
||||
var oldValue = this.map[name];
|
||||
this.map[name] = oldValue ? oldValue + ', ' + value : value;
|
||||
};
|
||||
|
||||
Headers.prototype['delete'] = function(name) {
|
||||
delete this.map[normalizeName(name)];
|
||||
};
|
||||
|
||||
Headers.prototype.get = function(name) {
|
||||
name = normalizeName(name);
|
||||
return this.has(name) ? this.map[name] : null
|
||||
};
|
||||
|
||||
Headers.prototype.has = function(name) {
|
||||
return this.map.hasOwnProperty(normalizeName(name))
|
||||
};
|
||||
|
||||
Headers.prototype.set = function(name, value) {
|
||||
this.map[normalizeName(name)] = normalizeValue(value);
|
||||
};
|
||||
|
||||
Headers.prototype.forEach = function(callback, thisArg) {
|
||||
for (var name in this.map) {
|
||||
if (this.map.hasOwnProperty(name)) {
|
||||
callback.call(thisArg, this.map[name], name, this);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Headers.prototype.keys = function() {
|
||||
var items = [];
|
||||
this.forEach(function(value, name) {
|
||||
items.push(name);
|
||||
});
|
||||
return iteratorFor(items)
|
||||
};
|
||||
|
||||
Headers.prototype.values = function() {
|
||||
var items = [];
|
||||
this.forEach(function(value) {
|
||||
items.push(value);
|
||||
});
|
||||
return iteratorFor(items)
|
||||
};
|
||||
|
||||
Headers.prototype.entries = function() {
|
||||
var items = [];
|
||||
this.forEach(function(value, name) {
|
||||
items.push([name, value]);
|
||||
});
|
||||
return iteratorFor(items)
|
||||
};
|
||||
|
||||
if (support.iterable) {
|
||||
Headers.prototype[Symbol.iterator] = Headers.prototype.entries;
|
||||
}
|
||||
|
||||
function consumed(body) {
|
||||
if (body.bodyUsed) {
|
||||
return Promise.reject(new TypeError('Already read'))
|
||||
}
|
||||
body.bodyUsed = true;
|
||||
}
|
||||
|
||||
function fileReaderReady(reader) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
reader.onload = function() {
|
||||
resolve(reader.result);
|
||||
};
|
||||
reader.onerror = function() {
|
||||
reject(reader.error);
|
||||
};
|
||||
})
|
||||
}
|
||||
|
||||
function readBlobAsArrayBuffer(blob) {
|
||||
var reader = new FileReader();
|
||||
var promise = fileReaderReady(reader);
|
||||
reader.readAsArrayBuffer(blob);
|
||||
return promise
|
||||
}
|
||||
|
||||
function readBlobAsText(blob) {
|
||||
var reader = new FileReader();
|
||||
var promise = fileReaderReady(reader);
|
||||
reader.readAsText(blob);
|
||||
return promise
|
||||
}
|
||||
|
||||
function readArrayBufferAsText(buf) {
|
||||
var view = new Uint8Array(buf);
|
||||
var chars = new Array(view.length);
|
||||
|
||||
for (var i = 0; i < view.length; i++) {
|
||||
chars[i] = String.fromCharCode(view[i]);
|
||||
}
|
||||
return chars.join('')
|
||||
}
|
||||
|
||||
function bufferClone(buf) {
|
||||
if (buf.slice) {
|
||||
return buf.slice(0)
|
||||
} else {
|
||||
var view = new Uint8Array(buf.byteLength);
|
||||
view.set(new Uint8Array(buf));
|
||||
return view.buffer
|
||||
}
|
||||
}
|
||||
|
||||
function Body() {
|
||||
this.bodyUsed = false;
|
||||
|
||||
this._initBody = function(body) {
|
||||
/*
|
||||
fetch-mock wraps the Response object in an ES6 Proxy to
|
||||
provide useful test harness features such as flush. However, on
|
||||
ES5 browsers without fetch or Proxy support pollyfills must be used;
|
||||
the proxy-pollyfill is unable to proxy an attribute unless it exists
|
||||
on the object before the Proxy is created. This change ensures
|
||||
Response.bodyUsed exists on the instance, while maintaining the
|
||||
semantic of setting Request.bodyUsed in the constructor before
|
||||
_initBody is called.
|
||||
*/
|
||||
this.bodyUsed = this.bodyUsed;
|
||||
this._bodyInit = body;
|
||||
if (!body) {
|
||||
this._bodyText = '';
|
||||
} else if (typeof body === 'string') {
|
||||
this._bodyText = body;
|
||||
} else if (support.blob && Blob.prototype.isPrototypeOf(body)) {
|
||||
this._bodyBlob = body;
|
||||
} else if (support.formData && FormData.prototype.isPrototypeOf(body)) {
|
||||
this._bodyFormData = body;
|
||||
} else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
|
||||
this._bodyText = body.toString();
|
||||
} else if (support.arrayBuffer && support.blob && isDataView(body)) {
|
||||
this._bodyArrayBuffer = bufferClone(body.buffer);
|
||||
// IE 10-11 can't handle a DataView body.
|
||||
this._bodyInit = new Blob([this._bodyArrayBuffer]);
|
||||
} else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {
|
||||
this._bodyArrayBuffer = bufferClone(body);
|
||||
} else {
|
||||
this._bodyText = body = Object.prototype.toString.call(body);
|
||||
}
|
||||
|
||||
if (!this.headers.get('content-type')) {
|
||||
if (typeof body === 'string') {
|
||||
this.headers.set('content-type', 'text/plain;charset=UTF-8');
|
||||
} else if (this._bodyBlob && this._bodyBlob.type) {
|
||||
this.headers.set('content-type', this._bodyBlob.type);
|
||||
} else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
|
||||
this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if (support.blob) {
|
||||
this.blob = function() {
|
||||
var rejected = consumed(this);
|
||||
if (rejected) {
|
||||
return rejected
|
||||
}
|
||||
|
||||
if (this._bodyBlob) {
|
||||
return Promise.resolve(this._bodyBlob)
|
||||
} else if (this._bodyArrayBuffer) {
|
||||
return Promise.resolve(new Blob([this._bodyArrayBuffer]))
|
||||
} else if (this._bodyFormData) {
|
||||
throw new Error('could not read FormData body as blob')
|
||||
} else {
|
||||
return Promise.resolve(new Blob([this._bodyText]))
|
||||
}
|
||||
};
|
||||
|
||||
this.arrayBuffer = function() {
|
||||
if (this._bodyArrayBuffer) {
|
||||
var isConsumed = consumed(this);
|
||||
if (isConsumed) {
|
||||
return isConsumed
|
||||
}
|
||||
if (ArrayBuffer.isView(this._bodyArrayBuffer)) {
|
||||
return Promise.resolve(
|
||||
this._bodyArrayBuffer.buffer.slice(
|
||||
this._bodyArrayBuffer.byteOffset,
|
||||
this._bodyArrayBuffer.byteOffset + this._bodyArrayBuffer.byteLength
|
||||
)
|
||||
)
|
||||
} else {
|
||||
return Promise.resolve(this._bodyArrayBuffer)
|
||||
}
|
||||
} else {
|
||||
return this.blob().then(readBlobAsArrayBuffer)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
this.text = function() {
|
||||
var rejected = consumed(this);
|
||||
if (rejected) {
|
||||
return rejected
|
||||
}
|
||||
|
||||
if (this._bodyBlob) {
|
||||
return readBlobAsText(this._bodyBlob)
|
||||
} else if (this._bodyArrayBuffer) {
|
||||
return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer))
|
||||
} else if (this._bodyFormData) {
|
||||
throw new Error('could not read FormData body as text')
|
||||
} else {
|
||||
return Promise.resolve(this._bodyText)
|
||||
}
|
||||
};
|
||||
|
||||
if (support.formData) {
|
||||
this.formData = function() {
|
||||
return this.text().then(decode)
|
||||
};
|
||||
}
|
||||
|
||||
this.json = function() {
|
||||
return this.text().then(JSON.parse)
|
||||
};
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
// HTTP methods whose capitalization should be normalized
|
||||
var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT'];
|
||||
|
||||
function normalizeMethod(method) {
|
||||
var upcased = method.toUpperCase();
|
||||
return methods.indexOf(upcased) > -1 ? upcased : method
|
||||
}
|
||||
|
||||
function Request(input, options) {
|
||||
if (!(this instanceof Request)) {
|
||||
throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.')
|
||||
}
|
||||
|
||||
options = options || {};
|
||||
var body = options.body;
|
||||
|
||||
if (input instanceof Request) {
|
||||
if (input.bodyUsed) {
|
||||
throw new TypeError('Already read')
|
||||
}
|
||||
this.url = input.url;
|
||||
this.credentials = input.credentials;
|
||||
if (!options.headers) {
|
||||
this.headers = new Headers(input.headers);
|
||||
}
|
||||
this.method = input.method;
|
||||
this.mode = input.mode;
|
||||
this.signal = input.signal;
|
||||
if (!body && input._bodyInit != null) {
|
||||
body = input._bodyInit;
|
||||
input.bodyUsed = true;
|
||||
}
|
||||
} else {
|
||||
this.url = String(input);
|
||||
}
|
||||
|
||||
this.credentials = options.credentials || this.credentials || 'same-origin';
|
||||
if (options.headers || !this.headers) {
|
||||
this.headers = new Headers(options.headers);
|
||||
}
|
||||
this.method = normalizeMethod(options.method || this.method || 'GET');
|
||||
this.mode = options.mode || this.mode || null;
|
||||
this.signal = options.signal || this.signal;
|
||||
this.referrer = null;
|
||||
|
||||
if ((this.method === 'GET' || this.method === 'HEAD') && body) {
|
||||
throw new TypeError('Body not allowed for GET or HEAD requests')
|
||||
}
|
||||
this._initBody(body);
|
||||
|
||||
if (this.method === 'GET' || this.method === 'HEAD') {
|
||||
if (options.cache === 'no-store' || options.cache === 'no-cache') {
|
||||
// Search for a '_' parameter in the query string
|
||||
var reParamSearch = /([?&])_=[^&]*/;
|
||||
if (reParamSearch.test(this.url)) {
|
||||
// If it already exists then set the value with the current time
|
||||
this.url = this.url.replace(reParamSearch, '$1_=' + new Date().getTime());
|
||||
} else {
|
||||
// Otherwise add a new '_' parameter to the end with the current time
|
||||
var reQueryString = /\?/;
|
||||
this.url += (reQueryString.test(this.url) ? '&' : '?') + '_=' + new Date().getTime();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Request.prototype.clone = function() {
|
||||
return new Request(this, {body: this._bodyInit})
|
||||
};
|
||||
|
||||
function decode(body) {
|
||||
var form = new FormData();
|
||||
body
|
||||
.trim()
|
||||
.split('&')
|
||||
.forEach(function(bytes) {
|
||||
if (bytes) {
|
||||
var split = bytes.split('=');
|
||||
var name = split.shift().replace(/\+/g, ' ');
|
||||
var value = split.join('=').replace(/\+/g, ' ');
|
||||
form.append(decodeURIComponent(name), decodeURIComponent(value));
|
||||
}
|
||||
});
|
||||
return form
|
||||
}
|
||||
|
||||
function parseHeaders(rawHeaders) {
|
||||
var headers = new Headers();
|
||||
// Replace instances of \r\n and \n followed by at least one space or horizontal tab with a space
|
||||
// https://tools.ietf.org/html/rfc7230#section-3.2
|
||||
var preProcessedHeaders = rawHeaders.replace(/\r?\n[\t ]+/g, ' ');
|
||||
// Avoiding split via regex to work around a common IE11 bug with the core-js 3.6.0 regex polyfill
|
||||
// https://github.com/github/fetch/issues/748
|
||||
// https://github.com/zloirock/core-js/issues/751
|
||||
preProcessedHeaders
|
||||
.split('\r')
|
||||
.map(function(header) {
|
||||
return header.indexOf('\n') === 0 ? header.substr(1, header.length) : header
|
||||
})
|
||||
.forEach(function(line) {
|
||||
var parts = line.split(':');
|
||||
var key = parts.shift().trim();
|
||||
if (key) {
|
||||
var value = parts.join(':').trim();
|
||||
headers.append(key, value);
|
||||
}
|
||||
});
|
||||
return headers
|
||||
}
|
||||
|
||||
Body.call(Request.prototype);
|
||||
|
||||
function Response(bodyInit, options) {
|
||||
if (!(this instanceof Response)) {
|
||||
throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.')
|
||||
}
|
||||
if (!options) {
|
||||
options = {};
|
||||
}
|
||||
|
||||
this.type = 'default';
|
||||
this.status = options.status === undefined ? 200 : options.status;
|
||||
this.ok = this.status >= 200 && this.status < 300;
|
||||
this.statusText = options.statusText === undefined ? '' : '' + options.statusText;
|
||||
this.headers = new Headers(options.headers);
|
||||
this.url = options.url || '';
|
||||
this._initBody(bodyInit);
|
||||
}
|
||||
|
||||
Body.call(Response.prototype);
|
||||
|
||||
Response.prototype.clone = function() {
|
||||
return new Response(this._bodyInit, {
|
||||
status: this.status,
|
||||
statusText: this.statusText,
|
||||
headers: new Headers(this.headers),
|
||||
url: this.url
|
||||
})
|
||||
};
|
||||
|
||||
Response.error = function() {
|
||||
var response = new Response(null, {status: 0, statusText: ''});
|
||||
response.type = 'error';
|
||||
return response
|
||||
};
|
||||
|
||||
var redirectStatuses = [301, 302, 303, 307, 308];
|
||||
|
||||
Response.redirect = function(url, status) {
|
||||
if (redirectStatuses.indexOf(status) === -1) {
|
||||
throw new RangeError('Invalid status code')
|
||||
}
|
||||
|
||||
return new Response(null, {status: status, headers: {location: url}})
|
||||
};
|
||||
|
||||
exports.DOMException = global.DOMException;
|
||||
try {
|
||||
new exports.DOMException();
|
||||
} catch (err) {
|
||||
exports.DOMException = function(message, name) {
|
||||
this.message = message;
|
||||
this.name = name;
|
||||
var error = Error(message);
|
||||
this.stack = error.stack;
|
||||
};
|
||||
exports.DOMException.prototype = Object.create(Error.prototype);
|
||||
exports.DOMException.prototype.constructor = exports.DOMException;
|
||||
}
|
||||
|
||||
function fetch(input, init) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
var request = new Request(input, init);
|
||||
|
||||
if (request.signal && request.signal.aborted) {
|
||||
return reject(new exports.DOMException('Aborted', 'AbortError'))
|
||||
}
|
||||
|
||||
var xhr = new XMLHttpRequest();
|
||||
|
||||
function abortXhr() {
|
||||
xhr.abort();
|
||||
}
|
||||
|
||||
xhr.onload = function() {
|
||||
var options = {
|
||||
status: xhr.status,
|
||||
statusText: xhr.statusText,
|
||||
headers: parseHeaders(xhr.getAllResponseHeaders() || '')
|
||||
};
|
||||
options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL');
|
||||
var body = 'response' in xhr ? xhr.response : xhr.responseText;
|
||||
setTimeout(function() {
|
||||
resolve(new Response(body, options));
|
||||
}, 0);
|
||||
};
|
||||
|
||||
xhr.onerror = function() {
|
||||
setTimeout(function() {
|
||||
reject(new TypeError('Network request failed'));
|
||||
}, 0);
|
||||
};
|
||||
|
||||
xhr.ontimeout = function() {
|
||||
setTimeout(function() {
|
||||
reject(new TypeError('Network request failed'));
|
||||
}, 0);
|
||||
};
|
||||
|
||||
xhr.onabort = function() {
|
||||
setTimeout(function() {
|
||||
reject(new exports.DOMException('Aborted', 'AbortError'));
|
||||
}, 0);
|
||||
};
|
||||
|
||||
function fixUrl(url) {
|
||||
try {
|
||||
return url === '' && global.location.href ? global.location.href : url
|
||||
} catch (e) {
|
||||
return url
|
||||
}
|
||||
}
|
||||
|
||||
xhr.open(request.method, fixUrl(request.url), true);
|
||||
|
||||
if (request.credentials === 'include') {
|
||||
xhr.withCredentials = true;
|
||||
} else if (request.credentials === 'omit') {
|
||||
xhr.withCredentials = false;
|
||||
}
|
||||
|
||||
if ('responseType' in xhr) {
|
||||
if (support.blob) {
|
||||
xhr.responseType = 'blob';
|
||||
} else if (
|
||||
support.arrayBuffer &&
|
||||
request.headers.get('Content-Type') &&
|
||||
request.headers.get('Content-Type').indexOf('application/octet-stream') !== -1
|
||||
) {
|
||||
xhr.responseType = 'arraybuffer';
|
||||
}
|
||||
}
|
||||
|
||||
if (init && typeof init.headers === 'object' && !(init.headers instanceof Headers)) {
|
||||
Object.getOwnPropertyNames(init.headers).forEach(function(name) {
|
||||
xhr.setRequestHeader(name, normalizeValue(init.headers[name]));
|
||||
});
|
||||
} else {
|
||||
request.headers.forEach(function(value, name) {
|
||||
xhr.setRequestHeader(name, value);
|
||||
});
|
||||
}
|
||||
|
||||
if (request.signal) {
|
||||
request.signal.addEventListener('abort', abortXhr);
|
||||
|
||||
xhr.onreadystatechange = function() {
|
||||
// DONE (success or failure)
|
||||
if (xhr.readyState === 4) {
|
||||
request.signal.removeEventListener('abort', abortXhr);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit);
|
||||
})
|
||||
}
|
||||
|
||||
fetch.polyfill = true;
|
||||
|
||||
if (!global.fetch) {
|
||||
global.fetch = fetch;
|
||||
global.Headers = Headers;
|
||||
global.Request = Request;
|
||||
global.Response = Response;
|
||||
}
|
||||
|
||||
exports.Headers = Headers;
|
||||
exports.Request = Request;
|
||||
exports.Response = Response;
|
||||
exports.fetch = fetch;
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
})));
|
1
static/wp-includes/js/dist/vendor/wp-polyfill-fetch.min.js
vendored
Executable file
1
static/wp-includes/js/dist/vendor/wp-polyfill-fetch.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
441
static/wp-includes/js/dist/vendor/wp-polyfill-formdata.js
vendored
Executable file
441
static/wp-includes/js/dist/vendor/wp-polyfill-formdata.js
vendored
Executable file
@ -0,0 +1,441 @@
|
||||
/* formdata-polyfill. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */
|
||||
|
||||
/* global FormData self Blob File */
|
||||
/* eslint-disable no-inner-declarations */
|
||||
|
||||
if (typeof Blob !== 'undefined' && (typeof FormData === 'undefined' || !FormData.prototype.keys)) {
|
||||
const global = typeof globalThis === 'object'
|
||||
? globalThis
|
||||
: typeof window === 'object'
|
||||
? window
|
||||
: typeof self === 'object' ? self : this
|
||||
|
||||
// keep a reference to native implementation
|
||||
const _FormData = global.FormData
|
||||
|
||||
// To be monkey patched
|
||||
const _send = global.XMLHttpRequest && global.XMLHttpRequest.prototype.send
|
||||
const _fetch = global.Request && global.fetch
|
||||
const _sendBeacon = global.navigator && global.navigator.sendBeacon
|
||||
// Might be a worker thread...
|
||||
const _match = global.Element && global.Element.prototype
|
||||
|
||||
// Unable to patch Request/Response constructor correctly #109
|
||||
// only way is to use ES6 class extend
|
||||
// https://github.com/babel/babel/issues/1966
|
||||
|
||||
const stringTag = global.Symbol && Symbol.toStringTag
|
||||
|
||||
// Add missing stringTags to blob and files
|
||||
if (stringTag) {
|
||||
if (!Blob.prototype[stringTag]) {
|
||||
Blob.prototype[stringTag] = 'Blob'
|
||||
}
|
||||
|
||||
if ('File' in global && !File.prototype[stringTag]) {
|
||||
File.prototype[stringTag] = 'File'
|
||||
}
|
||||
}
|
||||
|
||||
// Fix so you can construct your own File
|
||||
try {
|
||||
new File([], '') // eslint-disable-line
|
||||
} catch (a) {
|
||||
global.File = function File (b, d, c) {
|
||||
const blob = new Blob(b, c || {})
|
||||
const t = c && void 0 !== c.lastModified ? new Date(c.lastModified) : new Date()
|
||||
|
||||
Object.defineProperties(blob, {
|
||||
name: {
|
||||
value: d
|
||||
},
|
||||
lastModified: {
|
||||
value: +t
|
||||
},
|
||||
toString: {
|
||||
value () {
|
||||
return '[object File]'
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
if (stringTag) {
|
||||
Object.defineProperty(blob, stringTag, {
|
||||
value: 'File'
|
||||
})
|
||||
}
|
||||
|
||||
return blob
|
||||
}
|
||||
}
|
||||
|
||||
function ensureArgs (args, expected) {
|
||||
if (args.length < expected) {
|
||||
throw new TypeError(`${expected} argument required, but only ${args.length} present.`)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} name
|
||||
* @param {string | undefined} filename
|
||||
* @returns {[string, File|string]}
|
||||
*/
|
||||
function normalizeArgs (name, value, filename) {
|
||||
if (value instanceof Blob) {
|
||||
filename = filename !== undefined
|
||||
? String(filename + '')
|
||||
: typeof value.name === 'string'
|
||||
? value.name
|
||||
: 'blob'
|
||||
|
||||
if (value.name !== filename || Object.prototype.toString.call(value) === '[object Blob]') {
|
||||
value = new File([value], filename)
|
||||
}
|
||||
return [String(name), value]
|
||||
}
|
||||
return [String(name), String(value)]
|
||||
}
|
||||
|
||||
// normalize line feeds for textarea
|
||||
// https://html.spec.whatwg.org/multipage/form-elements.html#textarea-line-break-normalisation-transformation
|
||||
function normalizeLinefeeds (value) {
|
||||
return value.replace(/\r?\n|\r/g, '\r\n')
|
||||
}
|
||||
|
||||
/**
|
||||
* @template T
|
||||
* @param {ArrayLike<T>} arr
|
||||
* @param {{ (elm: T): void; }} cb
|
||||
*/
|
||||
function each (arr, cb) {
|
||||
for (let i = 0; i < arr.length; i++) {
|
||||
cb(arr[i])
|
||||
}
|
||||
}
|
||||
|
||||
const escape = str => str.replace(/\n/g, '%0A').replace(/\r/g, '%0D').replace(/"/g, '%22')
|
||||
|
||||
/**
|
||||
* @implements {Iterable}
|
||||
*/
|
||||
class FormDataPolyfill {
|
||||
/**
|
||||
* FormData class
|
||||
*
|
||||
* @param {HTMLFormElement=} form
|
||||
*/
|
||||
constructor (form) {
|
||||
/** @type {[string, string|File][]} */
|
||||
this._data = []
|
||||
|
||||
const self = this
|
||||
form && each(form.elements, (/** @type {HTMLInputElement} */ elm) => {
|
||||
if (
|
||||
!elm.name ||
|
||||
elm.disabled ||
|
||||
elm.type === 'submit' ||
|
||||
elm.type === 'button' ||
|
||||
elm.matches('form fieldset[disabled] *')
|
||||
) return
|
||||
|
||||
if (elm.type === 'file') {
|
||||
const files = elm.files && elm.files.length
|
||||
? elm.files
|
||||
: [new File([], '', { type: 'application/octet-stream' })] // #78
|
||||
|
||||
each(files, file => {
|
||||
self.append(elm.name, file)
|
||||
})
|
||||
} else if (elm.type === 'select-multiple' || elm.type === 'select-one') {
|
||||
each(elm.options, opt => {
|
||||
!opt.disabled && opt.selected && self.append(elm.name, opt.value)
|
||||
})
|
||||
} else if (elm.type === 'checkbox' || elm.type === 'radio') {
|
||||
if (elm.checked) self.append(elm.name, elm.value)
|
||||
} else {
|
||||
const value = elm.type === 'textarea' ? normalizeLinefeeds(elm.value) : elm.value
|
||||
self.append(elm.name, value)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Append a field
|
||||
*
|
||||
* @param {string} name field name
|
||||
* @param {string|Blob|File} value string / blob / file
|
||||
* @param {string=} filename filename to use with blob
|
||||
* @return {undefined}
|
||||
*/
|
||||
append (name, value, filename) {
|
||||
ensureArgs(arguments, 2)
|
||||
this._data.push(normalizeArgs(name, value, filename))
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete all fields values given name
|
||||
*
|
||||
* @param {string} name Field name
|
||||
* @return {undefined}
|
||||
*/
|
||||
delete (name) {
|
||||
ensureArgs(arguments, 1)
|
||||
const result = []
|
||||
name = String(name)
|
||||
|
||||
each(this._data, entry => {
|
||||
entry[0] !== name && result.push(entry)
|
||||
})
|
||||
|
||||
this._data = result
|
||||
}
|
||||
|
||||
/**
|
||||
* Iterate over all fields as [name, value]
|
||||
*
|
||||
* @return {Iterator}
|
||||
*/
|
||||
* entries () {
|
||||
for (var i = 0; i < this._data.length; i++) {
|
||||
yield this._data[i]
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Iterate over all fields
|
||||
*
|
||||
* @param {Function} callback Executed for each item with parameters (value, name, thisArg)
|
||||
* @param {Object=} thisArg `this` context for callback function
|
||||
*/
|
||||
forEach (callback, thisArg) {
|
||||
ensureArgs(arguments, 1)
|
||||
for (const [name, value] of this) {
|
||||
callback.call(thisArg, value, name, this)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return first field value given name
|
||||
* or null if non existent
|
||||
*
|
||||
* @param {string} name Field name
|
||||
* @return {string|File|null} value Fields value
|
||||
*/
|
||||
get (name) {
|
||||
ensureArgs(arguments, 1)
|
||||
const entries = this._data
|
||||
name = String(name)
|
||||
for (let i = 0; i < entries.length; i++) {
|
||||
if (entries[i][0] === name) {
|
||||
return entries[i][1]
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all fields values given name
|
||||
*
|
||||
* @param {string} name Fields name
|
||||
* @return {Array} [{String|File}]
|
||||
*/
|
||||
getAll (name) {
|
||||
ensureArgs(arguments, 1)
|
||||
const result = []
|
||||
name = String(name)
|
||||
each(this._data, data => {
|
||||
data[0] === name && result.push(data[1])
|
||||
})
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for field name existence
|
||||
*
|
||||
* @param {string} name Field name
|
||||
* @return {boolean}
|
||||
*/
|
||||
has (name) {
|
||||
ensureArgs(arguments, 1)
|
||||
name = String(name)
|
||||
for (let i = 0; i < this._data.length; i++) {
|
||||
if (this._data[i][0] === name) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
/**
|
||||
* Iterate over all fields name
|
||||
*
|
||||
* @return {Iterator}
|
||||
*/
|
||||
* keys () {
|
||||
for (const [name] of this) {
|
||||
yield name
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Overwrite all values given name
|
||||
*
|
||||
* @param {string} name Filed name
|
||||
* @param {string} value Field value
|
||||
* @param {string=} filename Filename (optional)
|
||||
*/
|
||||
set (name, value, filename) {
|
||||
ensureArgs(arguments, 2)
|
||||
name = String(name)
|
||||
/** @type {[string, string|File][]} */
|
||||
const result = []
|
||||
const args = normalizeArgs(name, value, filename)
|
||||
let replace = true
|
||||
|
||||
// - replace the first occurrence with same name
|
||||
// - discards the remaining with same name
|
||||
// - while keeping the same order items where added
|
||||
each(this._data, data => {
|
||||
data[0] === name
|
||||
? replace && (replace = !result.push(args))
|
||||
: result.push(data)
|
||||
})
|
||||
|
||||
replace && result.push(args)
|
||||
|
||||
this._data = result
|
||||
}
|
||||
|
||||
/**
|
||||
* Iterate over all fields
|
||||
*
|
||||
* @return {Iterator}
|
||||
*/
|
||||
* values () {
|
||||
for (const [, value] of this) {
|
||||
yield value
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a native (perhaps degraded) FormData with only a `append` method
|
||||
* Can throw if it's not supported
|
||||
*
|
||||
* @return {FormData}
|
||||
*/
|
||||
['_asNative'] () {
|
||||
const fd = new _FormData()
|
||||
|
||||
for (const [name, value] of this) {
|
||||
fd.append(name, value)
|
||||
}
|
||||
|
||||
return fd
|
||||
}
|
||||
|
||||
/**
|
||||
* [_blob description]
|
||||
*
|
||||
* @return {Blob} [description]
|
||||
*/
|
||||
['_blob'] () {
|
||||
const boundary = '----formdata-polyfill-' + Math.random(),
|
||||
chunks = [],
|
||||
p = `--${boundary}\r\nContent-Disposition: form-data; name="`
|
||||
this.forEach((value, name) => typeof value == 'string'
|
||||
? chunks.push(p + escape(normalizeLinefeeds(name)) + `"\r\n\r\n${normalizeLinefeeds(value)}\r\n`)
|
||||
: chunks.push(p + escape(normalizeLinefeeds(name)) + `"; filename="${escape(value.name)}"\r\nContent-Type: ${value.type||"application/octet-stream"}\r\n\r\n`, value, `\r\n`))
|
||||
chunks.push(`--${boundary}--`)
|
||||
return new Blob(chunks, {
|
||||
type: "multipart/form-data; boundary=" + boundary
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* The class itself is iterable
|
||||
* alias for formdata.entries()
|
||||
*
|
||||
* @return {Iterator}
|
||||
*/
|
||||
[Symbol.iterator] () {
|
||||
return this.entries()
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the default string description.
|
||||
*
|
||||
* @return {string} [object FormData]
|
||||
*/
|
||||
toString () {
|
||||
return '[object FormData]'
|
||||
}
|
||||
}
|
||||
|
||||
if (_match && !_match.matches) {
|
||||
_match.matches =
|
||||
_match.matchesSelector ||
|
||||
_match.mozMatchesSelector ||
|
||||
_match.msMatchesSelector ||
|
||||
_match.oMatchesSelector ||
|
||||
_match.webkitMatchesSelector ||
|
||||
function (s) {
|
||||
var matches = (this.document || this.ownerDocument).querySelectorAll(s)
|
||||
var i = matches.length
|
||||
while (--i >= 0 && matches.item(i) !== this) {}
|
||||
return i > -1
|
||||
}
|
||||
}
|
||||
|
||||
if (stringTag) {
|
||||
/**
|
||||
* Create the default string description.
|
||||
* It is accessed internally by the Object.prototype.toString().
|
||||
*/
|
||||
FormDataPolyfill.prototype[stringTag] = 'FormData'
|
||||
}
|
||||
|
||||
// Patch xhr's send method to call _blob transparently
|
||||
if (_send) {
|
||||
const setRequestHeader = global.XMLHttpRequest.prototype.setRequestHeader
|
||||
|
||||
global.XMLHttpRequest.prototype.setRequestHeader = function (name, value) {
|
||||
setRequestHeader.call(this, name, value)
|
||||
if (name.toLowerCase() === 'content-type') this._hasContentType = true
|
||||
}
|
||||
|
||||
global.XMLHttpRequest.prototype.send = function (data) {
|
||||
// need to patch send b/c old IE don't send blob's type (#44)
|
||||
if (data instanceof FormDataPolyfill) {
|
||||
const blob = data['_blob']()
|
||||
if (!this._hasContentType) this.setRequestHeader('Content-Type', blob.type)
|
||||
_send.call(this, blob)
|
||||
} else {
|
||||
_send.call(this, data)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Patch fetch's function to call _blob transparently
|
||||
if (_fetch) {
|
||||
global.fetch = function (input, init) {
|
||||
if (init && init.body && init.body instanceof FormDataPolyfill) {
|
||||
init.body = init.body['_blob']()
|
||||
}
|
||||
|
||||
return _fetch.call(this, input, init)
|
||||
}
|
||||
}
|
||||
|
||||
// Patch navigator.sendBeacon to use native FormData
|
||||
if (_sendBeacon) {
|
||||
global.navigator.sendBeacon = function (url, data) {
|
||||
if (data instanceof FormDataPolyfill) {
|
||||
data = data['_asNative']()
|
||||
}
|
||||
return _sendBeacon.call(this, url, data)
|
||||
}
|
||||
}
|
||||
|
||||
global['FormData'] = FormDataPolyfill
|
||||
}
|
2
static/wp-includes/js/dist/vendor/wp-polyfill-formdata.min.js
vendored
Executable file
2
static/wp-includes/js/dist/vendor/wp-polyfill-formdata.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
34
static/wp-includes/js/dist/vendor/wp-polyfill-node-contains.js
vendored
Executable file
34
static/wp-includes/js/dist/vendor/wp-polyfill-node-contains.js
vendored
Executable file
@ -0,0 +1,34 @@
|
||||
|
||||
// Node.prototype.contains
|
||||
(function() {
|
||||
|
||||
function contains(node) {
|
||||
if (!(0 in arguments)) {
|
||||
throw new TypeError('1 argument is required');
|
||||
}
|
||||
|
||||
do {
|
||||
if (this === node) {
|
||||
return true;
|
||||
}
|
||||
// eslint-disable-next-line no-cond-assign
|
||||
} while (node = node && node.parentNode);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// IE
|
||||
if ('HTMLElement' in self && 'contains' in HTMLElement.prototype) {
|
||||
try {
|
||||
delete HTMLElement.prototype.contains;
|
||||
// eslint-disable-next-line no-empty
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
if ('Node' in self) {
|
||||
Node.prototype.contains = contains;
|
||||
} else {
|
||||
document.contains = Element.prototype.contains = contains;
|
||||
}
|
||||
|
||||
}());
|
1
static/wp-includes/js/dist/vendor/wp-polyfill-node-contains.min.js
vendored
Executable file
1
static/wp-includes/js/dist/vendor/wp-polyfill-node-contains.min.js
vendored
Executable file
@ -0,0 +1 @@
|
||||
!function(){function e(e){if(!(0 in arguments))throw new TypeError("1 argument is required");do{if(this===e)return!0}while(e=e&&e.parentNode);return!1}if("HTMLElement"in self&&"contains"in HTMLElement.prototype)try{delete HTMLElement.prototype.contains}catch(e){}"Node"in self?Node.prototype.contains=e:document.contains=Element.prototype.contains=e}();
|
304
static/wp-includes/js/dist/vendor/wp-polyfill-object-fit.js
vendored
Executable file
304
static/wp-includes/js/dist/vendor/wp-polyfill-object-fit.js
vendored
Executable file
@ -0,0 +1,304 @@
|
||||
/*----------------------------------------
|
||||
* objectFitPolyfill 2.3.5
|
||||
*
|
||||
* Made by Constance Chen
|
||||
* Released under the ISC license
|
||||
*
|
||||
* https://github.com/constancecchen/object-fit-polyfill
|
||||
*--------------------------------------*/
|
||||
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
// if the page is being rendered on the server, don't continue
|
||||
if (typeof window === 'undefined') return;
|
||||
|
||||
// Workaround for Edge 16-18, which only implemented object-fit for <img> tags
|
||||
var edgeMatch = window.navigator.userAgent.match(/Edge\/(\d{2})\./);
|
||||
var edgeVersion = edgeMatch ? parseInt(edgeMatch[1], 10) : null;
|
||||
var edgePartialSupport = edgeVersion
|
||||
? edgeVersion >= 16 && edgeVersion <= 18
|
||||
: false;
|
||||
|
||||
// If the browser does support object-fit, we don't need to continue
|
||||
var hasSupport = 'objectFit' in document.documentElement.style !== false;
|
||||
if (hasSupport && !edgePartialSupport) {
|
||||
window.objectFitPolyfill = function() {
|
||||
return false;
|
||||
};
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the container's parent element to make sure it will
|
||||
* correctly handle and clip absolutely positioned children
|
||||
*
|
||||
* @param {node} $container - parent element
|
||||
*/
|
||||
var checkParentContainer = function($container) {
|
||||
var styles = window.getComputedStyle($container, null);
|
||||
var position = styles.getPropertyValue('position');
|
||||
var overflow = styles.getPropertyValue('overflow');
|
||||
var display = styles.getPropertyValue('display');
|
||||
|
||||
if (!position || position === 'static') {
|
||||
$container.style.position = 'relative';
|
||||
}
|
||||
if (overflow !== 'hidden') {
|
||||
$container.style.overflow = 'hidden';
|
||||
}
|
||||
// Guesstimating that people want the parent to act like full width/height wrapper here.
|
||||
// Mostly attempts to target <picture> elements, which default to inline.
|
||||
if (!display || display === 'inline') {
|
||||
$container.style.display = 'block';
|
||||
}
|
||||
if ($container.clientHeight === 0) {
|
||||
$container.style.height = '100%';
|
||||
}
|
||||
|
||||
// Add a CSS class hook, in case people need to override styles for any reason.
|
||||
if ($container.className.indexOf('object-fit-polyfill') === -1) {
|
||||
$container.className = $container.className + ' object-fit-polyfill';
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Check for pre-set max-width/height, min-width/height,
|
||||
* positioning, or margins, which can mess up image calculations
|
||||
*
|
||||
* @param {node} $media - img/video element
|
||||
*/
|
||||
var checkMediaProperties = function($media) {
|
||||
var styles = window.getComputedStyle($media, null);
|
||||
var constraints = {
|
||||
'max-width': 'none',
|
||||
'max-height': 'none',
|
||||
'min-width': '0px',
|
||||
'min-height': '0px',
|
||||
top: 'auto',
|
||||
right: 'auto',
|
||||
bottom: 'auto',
|
||||
left: 'auto',
|
||||
'margin-top': '0px',
|
||||
'margin-right': '0px',
|
||||
'margin-bottom': '0px',
|
||||
'margin-left': '0px',
|
||||
};
|
||||
|
||||
for (var property in constraints) {
|
||||
var constraint = styles.getPropertyValue(property);
|
||||
|
||||
if (constraint !== constraints[property]) {
|
||||
$media.style[property] = constraints[property];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Calculate & set object-position
|
||||
*
|
||||
* @param {string} axis - either "x" or "y"
|
||||
* @param {node} $media - img or video element
|
||||
* @param {string} objectPosition - e.g. "50% 50%", "top left"
|
||||
*/
|
||||
var setPosition = function(axis, $media, objectPosition) {
|
||||
var position, other, start, end, side;
|
||||
objectPosition = objectPosition.split(' ');
|
||||
|
||||
if (objectPosition.length < 2) {
|
||||
objectPosition[1] = objectPosition[0];
|
||||
}
|
||||
|
||||
/* istanbul ignore else */
|
||||
if (axis === 'x') {
|
||||
position = objectPosition[0];
|
||||
other = objectPosition[1];
|
||||
start = 'left';
|
||||
end = 'right';
|
||||
side = $media.clientWidth;
|
||||
} else if (axis === 'y') {
|
||||
position = objectPosition[1];
|
||||
other = objectPosition[0];
|
||||
start = 'top';
|
||||
end = 'bottom';
|
||||
side = $media.clientHeight;
|
||||
} else {
|
||||
return; // Neither x or y axis specified
|
||||
}
|
||||
|
||||
if (position === start || other === start) {
|
||||
$media.style[start] = '0';
|
||||
return;
|
||||
}
|
||||
|
||||
if (position === end || other === end) {
|
||||
$media.style[end] = '0';
|
||||
return;
|
||||
}
|
||||
|
||||
if (position === 'center' || position === '50%') {
|
||||
$media.style[start] = '50%';
|
||||
$media.style['margin-' + start] = side / -2 + 'px';
|
||||
return;
|
||||
}
|
||||
|
||||
// Percentage values (e.g., 30% 10%)
|
||||
if (position.indexOf('%') >= 0) {
|
||||
position = parseInt(position, 10);
|
||||
|
||||
if (position < 50) {
|
||||
$media.style[start] = position + '%';
|
||||
$media.style['margin-' + start] = side * (position / -100) + 'px';
|
||||
} else {
|
||||
position = 100 - position;
|
||||
$media.style[end] = position + '%';
|
||||
$media.style['margin-' + end] = side * (position / -100) + 'px';
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
// Length-based values (e.g. 10px / 10em)
|
||||
else {
|
||||
$media.style[start] = position;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Calculate & set object-fit
|
||||
*
|
||||
* @param {node} $media - img/video/picture element
|
||||
*/
|
||||
var objectFit = function($media) {
|
||||
// IE 10- data polyfill
|
||||
var fit = $media.dataset
|
||||
? $media.dataset.objectFit
|
||||
: $media.getAttribute('data-object-fit');
|
||||
var position = $media.dataset
|
||||
? $media.dataset.objectPosition
|
||||
: $media.getAttribute('data-object-position');
|
||||
|
||||
// Default fallbacks
|
||||
fit = fit || 'cover';
|
||||
position = position || '50% 50%';
|
||||
|
||||
// If necessary, make the parent container work with absolutely positioned elements
|
||||
var $container = $media.parentNode;
|
||||
checkParentContainer($container);
|
||||
|
||||
// Check for any pre-set CSS which could mess up image calculations
|
||||
checkMediaProperties($media);
|
||||
|
||||
// Reset any pre-set width/height CSS and handle fit positioning
|
||||
$media.style.position = 'absolute';
|
||||
$media.style.width = 'auto';
|
||||
$media.style.height = 'auto';
|
||||
|
||||
// `scale-down` chooses either `none` or `contain`, whichever is smaller
|
||||
if (fit === 'scale-down') {
|
||||
if (
|
||||
$media.clientWidth < $container.clientWidth &&
|
||||
$media.clientHeight < $container.clientHeight
|
||||
) {
|
||||
fit = 'none';
|
||||
} else {
|
||||
fit = 'contain';
|
||||
}
|
||||
}
|
||||
|
||||
// `none` (width/height auto) and `fill` (100%) and are straightforward
|
||||
if (fit === 'none') {
|
||||
setPosition('x', $media, position);
|
||||
setPosition('y', $media, position);
|
||||
return;
|
||||
}
|
||||
|
||||
if (fit === 'fill') {
|
||||
$media.style.width = '100%';
|
||||
$media.style.height = '100%';
|
||||
setPosition('x', $media, position);
|
||||
setPosition('y', $media, position);
|
||||
return;
|
||||
}
|
||||
|
||||
// `cover` and `contain` must figure out which side needs covering, and add CSS positioning & centering
|
||||
$media.style.height = '100%';
|
||||
|
||||
if (
|
||||
(fit === 'cover' && $media.clientWidth > $container.clientWidth) ||
|
||||
(fit === 'contain' && $media.clientWidth < $container.clientWidth)
|
||||
) {
|
||||
$media.style.top = '0';
|
||||
$media.style.marginTop = '0';
|
||||
setPosition('x', $media, position);
|
||||
} else {
|
||||
$media.style.width = '100%';
|
||||
$media.style.height = 'auto';
|
||||
$media.style.left = '0';
|
||||
$media.style.marginLeft = '0';
|
||||
setPosition('y', $media, position);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Initialize plugin
|
||||
*
|
||||
* @param {node} media - Optional specific DOM node(s) to be polyfilled
|
||||
*/
|
||||
var objectFitPolyfill = function(media) {
|
||||
if (typeof media === 'undefined' || media instanceof Event) {
|
||||
// If left blank, or a default event, all media on the page will be polyfilled.
|
||||
media = document.querySelectorAll('[data-object-fit]');
|
||||
} else if (media && media.nodeName) {
|
||||
// If it's a single node, wrap it in an array so it works.
|
||||
media = [media];
|
||||
} else if (typeof media === 'object' && media.length && media[0].nodeName) {
|
||||
// If it's an array of DOM nodes (e.g. a jQuery selector), it's fine as-is.
|
||||
media = media;
|
||||
} else {
|
||||
// Otherwise, if it's invalid or an incorrect type, return false to let people know.
|
||||
return false;
|
||||
}
|
||||
|
||||
for (var i = 0; i < media.length; i++) {
|
||||
if (!media[i].nodeName) continue;
|
||||
|
||||
var mediaType = media[i].nodeName.toLowerCase();
|
||||
|
||||
if (mediaType === 'img') {
|
||||
if (edgePartialSupport) continue; // Edge supports object-fit for images (but nothing else), so no need to polyfill
|
||||
|
||||
if (media[i].complete) {
|
||||
objectFit(media[i]);
|
||||
} else {
|
||||
media[i].addEventListener('load', function() {
|
||||
objectFit(this);
|
||||
});
|
||||
}
|
||||
} else if (mediaType === 'video') {
|
||||
if (media[i].readyState > 0) {
|
||||
objectFit(media[i]);
|
||||
} else {
|
||||
media[i].addEventListener('loadedmetadata', function() {
|
||||
objectFit(this);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
objectFit(media[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
if (document.readyState === 'loading') {
|
||||
// Loading hasn't finished yet
|
||||
document.addEventListener('DOMContentLoaded', objectFitPolyfill);
|
||||
} else {
|
||||
// `DOMContentLoaded` has already fired
|
||||
objectFitPolyfill();
|
||||
}
|
||||
|
||||
window.addEventListener('resize', objectFitPolyfill);
|
||||
|
||||
window.objectFitPolyfill = objectFitPolyfill;
|
||||
})();
|
1
static/wp-includes/js/dist/vendor/wp-polyfill-object-fit.min.js
vendored
Executable file
1
static/wp-includes/js/dist/vendor/wp-polyfill-object-fit.min.js
vendored
Executable file
@ -0,0 +1 @@
|
||||
!function(){"use strict";if("undefined"!=typeof window){var t=window.navigator.userAgent.match(/Edge\/(\d{2})\./),e=t?parseInt(t[1],10):null,i=!!e&&16<=e&&e<=18;if("objectFit"in document.documentElement.style==0||i){var n=function(t,e,i){var n,o,l,a,d;if((i=i.split(" ")).length<2&&(i[1]=i[0]),"x"===t)n=i[0],o=i[1],l="left",a="right",d=e.clientWidth;else{if("y"!==t)return;n=i[1],o=i[0],l="top",a="bottom",d=e.clientHeight}if(n!==l&&o!==l){if(n!==a&&o!==a)return"center"===n||"50%"===n?(e.style[l]="50%",void(e.style["margin-"+l]=d/-2+"px")):void(0<=n.indexOf("%")?(n=parseInt(n,10))<50?(e.style[l]=n+"%",e.style["margin-"+l]=d*(n/-100)+"px"):(n=100-n,e.style[a]=n+"%",e.style["margin-"+a]=d*(n/-100)+"px"):e.style[l]=n);e.style[a]="0"}else e.style[l]="0"},o=function(t){var e=t.dataset?t.dataset.objectFit:t.getAttribute("data-object-fit"),i=t.dataset?t.dataset.objectPosition:t.getAttribute("data-object-position");e=e||"cover",i=i||"50% 50%";var o=t.parentNode;return function(t){var e=window.getComputedStyle(t,null),i=e.getPropertyValue("position"),n=e.getPropertyValue("overflow"),o=e.getPropertyValue("display");i&&"static"!==i||(t.style.position="relative"),"hidden"!==n&&(t.style.overflow="hidden"),o&&"inline"!==o||(t.style.display="block"),0===t.clientHeight&&(t.style.height="100%"),-1===t.className.indexOf("object-fit-polyfill")&&(t.className=t.className+" object-fit-polyfill")}(o),function(t){var e=window.getComputedStyle(t,null),i={"max-width":"none","max-height":"none","min-width":"0px","min-height":"0px",top:"auto",right:"auto",bottom:"auto",left:"auto","margin-top":"0px","margin-right":"0px","margin-bottom":"0px","margin-left":"0px"};for(var n in i)e.getPropertyValue(n)!==i[n]&&(t.style[n]=i[n])}(t),t.style.position="absolute",t.style.width="auto",t.style.height="auto","scale-down"===e&&(e=t.clientWidth<o.clientWidth&&t.clientHeight<o.clientHeight?"none":"contain"),"none"===e?(n("x",t,i),void n("y",t,i)):"fill"===e?(t.style.width="100%",t.style.height="100%",n("x",t,i),void n("y",t,i)):(t.style.height="100%",void("cover"===e&&t.clientWidth>o.clientWidth||"contain"===e&&t.clientWidth<o.clientWidth?(t.style.top="0",t.style.marginTop="0",n("x",t,i)):(t.style.width="100%",t.style.height="auto",t.style.left="0",t.style.marginLeft="0",n("y",t,i))))},l=function(t){if(void 0===t||t instanceof Event)t=document.querySelectorAll("[data-object-fit]");else if(t&&t.nodeName)t=[t];else{if("object"!=typeof t||!t.length||!t[0].nodeName)return!1;t=t}for(var e=0;e<t.length;e++)if(t[e].nodeName){var n=t[e].nodeName.toLowerCase();if("img"===n){if(i)continue;t[e].complete?o(t[e]):t[e].addEventListener("load",(function(){o(this)}))}else"video"===n?0<t[e].readyState?o(t[e]):t[e].addEventListener("loadedmetadata",(function(){o(this)})):o(t[e])}return!0};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",l):l(),window.addEventListener("resize",l),window.objectFitPolyfill=l}else window.objectFitPolyfill=function(){return!1}}}();
|
2987
static/wp-includes/js/dist/vendor/wp-polyfill-url.js
vendored
Executable file
2987
static/wp-includes/js/dist/vendor/wp-polyfill-url.js
vendored
Executable file
File diff suppressed because it is too large
Load Diff
1
static/wp-includes/js/dist/vendor/wp-polyfill-url.min.js
vendored
Executable file
1
static/wp-includes/js/dist/vendor/wp-polyfill-url.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
2257
static/wp-includes/js/dist/vendor/wp-polyfill.js
vendored
Executable file
2257
static/wp-includes/js/dist/vendor/wp-polyfill.js
vendored
Executable file
File diff suppressed because it is too large
Load Diff
1
static/wp-includes/js/dist/vendor/wp-polyfill.min.js
vendored
Executable file
1
static/wp-includes/js/dist/vendor/wp-polyfill.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
55
templates/index/index.html
Normal file
55
templates/index/index.html
Normal file
@ -0,0 +1,55 @@
|
||||
{{template "layout/base" .}}
|
||||
{{define "content" }}
|
||||
<div id="primary" class="content-area">
|
||||
<main id="main" class="site-main">
|
||||
{{ range $k,$v:=.posts}}
|
||||
<article id="post-{{$v.Id}}"
|
||||
class="post-{{$v.Id}} post type-post status-publish format-standard hentry category-uncategorized">
|
||||
|
||||
<header class="entry-header">
|
||||
<h2 class="entry-title">
|
||||
<a href="/p/{{$v.Id}}" rel="bookmark">{{$v.PostTitle}}</a>
|
||||
</h2>
|
||||
</header><!-- .entry-header -->
|
||||
|
||||
<div class="entry-content">
|
||||
<p>{{$v.PostContent|unescaped}}</p>
|
||||
</div><!-- .entry-content -->
|
||||
|
||||
<footer class="entry-footer">
|
||||
<span class="posted-on">
|
||||
<span class="screen-reader-text">发布于 </span>
|
||||
<a href="/p/{{$v.Id}}" rel="bookmark">
|
||||
<time class="entry-date published updated" datetime="{{$v.PostDateGmt}}">{{$v.PostDate|dateCh}}
|
||||
</time>
|
||||
</a>
|
||||
</span>
|
||||
<span class="cat-links">
|
||||
<span class="screen-reader-text">分类 </span>
|
||||
<a href="/p/category/uncategorized" rel="category tag">{{$v.CategoryName}}</a>
|
||||
</span>
|
||||
<span class="comments-link">
|
||||
<a href="/p/1#comments">
|
||||
<span class="screen-reader-text">{{$v.PostTitle}}</span>有1条评论
|
||||
</a>
|
||||
</span>
|
||||
</footer><!-- .entry-footer -->
|
||||
|
||||
</article><!-- #post-{{$v.Id}} -->
|
||||
{{end}}
|
||||
|
||||
|
||||
<nav class="navigation pagination" aria-label="文章">
|
||||
<h2 class="screen-reader-text">文章导航</h2>
|
||||
<div class="nav-links"><span aria-current="page" class="page-numbers current"><span
|
||||
class="meta-nav screen-reader-text">页 </span>1</span>
|
||||
<a class="page-numbers" href="/page/2"><span
|
||||
class="meta-nav screen-reader-text">页 </span>2</a>
|
||||
<span class="page-numbers dots">…</span>
|
||||
<a class="page-numbers" href="/page/37"><span
|
||||
class="meta-nav screen-reader-text">页 </span>37</a>
|
||||
<a class="next page-numbers" href="/page/2">下一页</a></div>
|
||||
</nav>
|
||||
</main><!-- .site-main -->
|
||||
</div>
|
||||
{{end}}
|
36
templates/layout/base.html
Normal file
36
templates/layout/base.html
Normal file
@ -0,0 +1,36 @@
|
||||
{{ define "layout/base"}}
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
{{template "layout/head" .}}
|
||||
{{block "head" .}}
|
||||
{{end}}
|
||||
</head>
|
||||
<body>
|
||||
<div id="page" class="hfeed site">
|
||||
<a class="skip-link screen-reader-text" href="#content">
|
||||
|
||||
</a>
|
||||
|
||||
<div id="sidebar" class="sidebar" style="position: relative; bottom: 0;">
|
||||
<header id="masthead" class="site-header">
|
||||
<div class="site-branding">
|
||||
<h1 class="site-title"><a href="/" rel="home">{{ .options.blogname }}</a></h1>
|
||||
<p class="site-description">{{.options.blogdescription}}</p>
|
||||
</div><!-- .site-branding -->
|
||||
</header>
|
||||
{{template "layout/sidebar" .}}
|
||||
</div><!-- .sidebar -->
|
||||
<div id="content" class="site-content">
|
||||
{{block "content" .}}
|
||||
|
||||
{{end}}
|
||||
</div>
|
||||
<footer id="colophon" class="site-footer">
|
||||
{{template "layout/footer" .}}
|
||||
</footer>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
{{ end }}
|
7
templates/layout/footer.html
Normal file
7
templates/layout/footer.html
Normal file
@ -0,0 +1,7 @@
|
||||
{{define "layout/footer"}}
|
||||
|
||||
<div class="site-info">
|
||||
<a href="https://cn.wordpress.org/" class="imprint">自豪地采用WordPress</a>
|
||||
</div>
|
||||
|
||||
{{end}}
|
43
templates/layout/head.html
Normal file
43
templates/layout/head.html
Normal file
File diff suppressed because one or more lines are too long
118
templates/layout/sidebar.html
Normal file
118
templates/layout/sidebar.html
Normal file
@ -0,0 +1,118 @@
|
||||
{{define "layout/sidebar" }}
|
||||
<div id="widget-area" class="widget-area" role="complementary">
|
||||
<aside id="search-2" class="widget widget_search">
|
||||
<form role="search" method="get" class="search-form" action="https://www.xloyy.com/">
|
||||
<label>
|
||||
<span class="screen-reader-text">搜索:</span>
|
||||
<input type="search" class="search-field" placeholder="搜索…" value="" name="s">
|
||||
</label>
|
||||
<input type="submit" class="search-submit screen-reader-text" value="搜索">
|
||||
</form>
|
||||
</aside>
|
||||
<aside id="recent-posts-2" class="widget widget_recent_entries">
|
||||
<h2 class="widget-title">近期文章</h2>
|
||||
<nav aria-label="近期文章">
|
||||
<ul>
|
||||
<li>
|
||||
<a href="https://www.xloyy.com/p/2799">密码保护:2022.9.12</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://www.xloyy.com/p/2797">密码保护:2022.9.11</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://www.xloyy.com/p/2795">密码保护:2022.9.10</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://www.xloyy.com/p/2793">密码保护:2022.9.9</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://www.xloyy.com/p/2789">密码保护:2022.9.8</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</aside>
|
||||
<aside id="recent-comments-2" class="widget widget_recent_comments"><h2 class="widget-title">近期评论</h2>
|
||||
<nav aria-label="近期评论">
|
||||
<ul id="recentcomments"></ul>
|
||||
</nav>
|
||||
</aside>
|
||||
<aside id="archives-2" class="widget widget_archive"><h2 class="widget-title">归档</h2>
|
||||
<nav aria-label="归档">
|
||||
<ul>
|
||||
<li><a href="https://www.xloyy.com/p/date/2022/09">2022年9月</a></li>
|
||||
<li><a href="https://www.xloyy.com/p/date/2022/08">2022年8月</a></li>
|
||||
<li><a href="https://www.xloyy.com/p/date/2022/07">2022年7月</a></li>
|
||||
<li><a href="https://www.xloyy.com/p/date/2022/06">2022年6月</a></li>
|
||||
<li><a href="https://www.xloyy.com/p/date/2022/05">2022年5月</a></li>
|
||||
<li><a href="https://www.xloyy.com/p/date/2022/04">2022年4月</a></li>
|
||||
<li><a href="https://www.xloyy.com/p/date/2022/03">2022年3月</a></li>
|
||||
<li><a href="https://www.xloyy.com/p/date/2022/02">2022年2月</a></li>
|
||||
<li><a href="https://www.xloyy.com/p/date/2022/01">2022年1月</a></li>
|
||||
<li><a href="https://www.xloyy.com/p/date/2021/12">2021年12月</a></li>
|
||||
<li><a href="https://www.xloyy.com/p/date/2021/11">2021年11月</a></li>
|
||||
<li><a href="https://www.xloyy.com/p/date/2021/10">2021年10月</a></li>
|
||||
<li><a href="https://www.xloyy.com/p/date/2021/09">2021年9月</a></li>
|
||||
<li><a href="https://www.xloyy.com/p/date/2021/08">2021年8月</a></li>
|
||||
<li><a href="https://www.xloyy.com/p/date/2021/07">2021年7月</a></li>
|
||||
<li><a href="https://www.xloyy.com/p/date/2021/06">2021年6月</a></li>
|
||||
<li><a href="https://www.xloyy.com/p/date/2021/05">2021年5月</a></li>
|
||||
<li><a href="https://www.xloyy.com/p/date/2021/04">2021年4月</a></li>
|
||||
<li><a href="https://www.xloyy.com/p/date/2021/03">2021年3月</a></li>
|
||||
<li><a href="https://www.xloyy.com/p/date/2021/02">2021年2月</a></li>
|
||||
<li><a href="https://www.xloyy.com/p/date/2021/01">2021年1月</a></li>
|
||||
<li><a href="https://www.xloyy.com/p/date/2020/12">2020年12月</a></li>
|
||||
<li><a href="https://www.xloyy.com/p/date/2020/11">2020年11月</a></li>
|
||||
<li><a href="https://www.xloyy.com/p/date/2020/10">2020年10月</a></li>
|
||||
<li><a href="https://www.xloyy.com/p/date/2020/09">2020年9月</a></li>
|
||||
<li><a href="https://www.xloyy.com/p/date/2020/08">2020年8月</a></li>
|
||||
<li><a href="https://www.xloyy.com/p/date/2020/07">2020年7月</a></li>
|
||||
<li><a href="https://www.xloyy.com/p/date/2020/06">2020年6月</a></li>
|
||||
<li><a href="https://www.xloyy.com/p/date/2020/05">2020年5月</a></li>
|
||||
<li><a href="https://www.xloyy.com/p/date/2019/05">2019年5月</a></li>
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</aside>
|
||||
<aside id="categories-2" class="widget widget_categories"><h2 class="widget-title">分类</h2>
|
||||
<nav aria-label="分类">
|
||||
<ul>
|
||||
<li class="cat-item cat-item-28"><a href="https://www.xloyy.com/p/category/docker">docker</a>
|
||||
</li>
|
||||
<li class="cat-item cat-item-2"><a href="https://www.xloyy.com/p/category/linux">linux</a>
|
||||
</li>
|
||||
<li class="cat-item cat-item-20"><a href="https://www.xloyy.com/p/category/mysql">mysql</a>
|
||||
</li>
|
||||
<li class="cat-item cat-item-14"><a href="https://www.xloyy.com/p/category/php">php</a>
|
||||
</li>
|
||||
<li class="cat-item cat-item-15"><a href="https://www.xloyy.com/p/category/web">web</a>
|
||||
</li>
|
||||
<li class="cat-item cat-item-24"><a
|
||||
href="https://www.xloyy.com/p/category/%e4%b8%bb%e6%9c%ba%e6%b8%b8%e6%88%8f">主机游戏</a>
|
||||
</li>
|
||||
<li class="cat-item cat-item-16"><a href="https://www.xloyy.com/p/category/%e5%85%b6%e5%ae%83">其它</a>
|
||||
</li>
|
||||
<li class="cat-item cat-item-25"><a href="https://www.xloyy.com/p/category/%e6%97%a5%e8%ae%b0">日记</a>
|
||||
</li>
|
||||
<li class="cat-item cat-item-1"><a href="https://www.xloyy.com/p/category/uncategorized">未分类</a>
|
||||
</li>
|
||||
<li class="cat-item cat-item-26"><a href="https://www.xloyy.com/p/category/%e6%9d%82%e8%b0%88">杂谈</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</aside>
|
||||
<aside id="meta-2" class="widget widget_meta"><h2 class="widget-title">其他操作</h2>
|
||||
<nav aria-label="其他操作">
|
||||
<ul>
|
||||
<li><a href="https://www.xloyy.com/wp-login.php">登录</a></li>
|
||||
<li><a href="https://www.xloyy.com/feed">条目feed</a></li>
|
||||
<li><a href="https://www.xloyy.com/comments/feed">评论feed</a></li>
|
||||
|
||||
<li><a href="https://cn.wordpress.org/">WordPress.org</a></li>
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</aside>
|
||||
</div>
|
||||
{{end}}
|
Loading…
Reference in New Issue
Block a user