diff --git a/js/admin/dist/app.js b/js/admin/dist/app.js
index fa20c7ee1..c325ba7bd 100644
--- a/js/admin/dist/app.js
+++ b/js/admin/dist/app.js
@@ -569,11 +569,11 @@ exports.System = System;
global.m = m
}
/* eslint-enable no-undef */
-})(typeof window !== "undefined" ? window : {}, function (global, undefined) { // eslint-disable-line
+})(typeof window !== "undefined" ? window : this, function (global, undefined) { // eslint-disable-line
"use strict"
m.version = function () {
- return "v0.2.3"
+ return "v0.2.5"
}
var hasOwn = {}.hasOwnProperty
@@ -655,7 +655,7 @@ exports.System = System;
classes.push(match[2])
} else if (match[3][0] === "[") {
var pair = /\[(.+?)(?:=("|'|)(.*?)\2)?\]/.exec(match[3])
- cell.attrs[pair[1]] = pair[3] || (pair[2] ? "" : true)
+ cell.attrs[pair[1]] = pair[3] || ""
}
}
@@ -700,7 +700,11 @@ exports.System = System;
* or splat (optional)
*/
function m(tag, pairs) {
- var args = [].slice.call(arguments, 1)
+ var args = []
+
+ for (var i = 1, length = arguments.length; i < length; i++) {
+ args[i - 1] = arguments[i]
+ }
if (isObject(tag)) return parameterize(tag, args)
@@ -794,8 +798,10 @@ exports.System = System;
})
var actions = []
- for (var prop in existing) if (hasOwn.call(existing, prop)) {
- actions.push(existing[prop])
+ for (var prop in existing) {
+ if (hasOwn.call(existing, prop)) {
+ actions.push(existing[prop])
+ }
}
var changes = actions.sort(sortChanges)
@@ -926,8 +932,10 @@ exports.System = System;
if (cached.controllers) {
forEach(cached.controllers, function (controller) {
- if (controller.onunload) controller.onunload({preventDefault: noop});
- });
+ if (controller.onunload) {
+ controller.onunload({preventDefault: noop})
+ }
+ })
}
}
}
@@ -1308,7 +1316,9 @@ exports.System = System;
var unloaders = []
function updateLists(views, controllers, view, controller) {
- if (controller.onunload != null && unloaders.map(function(u) {return u.handler}).indexOf(controller.onunload) < 0) {
+ if (controller.onunload != null &&
+ unloaders.map(function (u) { return u.handler })
+ .indexOf(controller.onunload) < 0) {
unloaders.push({
controller: controller,
handler: controller.onunload
@@ -1320,11 +1330,32 @@ exports.System = System;
}
var forcing = false
- function checkView(data, view, cached, cachedControllers, controllers, views) {
- var controller = getController(cached.views, view, cachedControllers, data.controller)
+ function checkView(
+ data,
+ view,
+ cached,
+ cachedControllers,
+ controllers,
+ views
+ ) {
+ var controller = getController(
+ cached.views,
+ view,
+ cachedControllers,
+ data.controller)
+
var key = data && data.attrs && data.attrs.key
- data = pendingRequests === 0 || forcing || cachedControllers && cachedControllers.indexOf(controller) > -1 ? data.view(controller) : {tag: "placeholder"}
- if (data.subtree === "retain") return data;
+
+ if (pendingRequests === 0 ||
+ forcing ||
+ cachedControllers &&
+ cachedControllers.indexOf(controller) > -1) {
+ data = data.view(controller)
+ } else {
+ data = {tag: "placeholder"}
+ }
+
+ if (data.subtree === "retain") return data
data.attrs = data.attrs || {}
data.attrs.key = key
updateLists(views, controllers, view, controller)
@@ -1389,6 +1420,9 @@ exports.System = System;
// set attributes first, then create children
var attrs = constructAttrs(data, node, namespace, hasKeys)
+ // add the node to its parent before attaching children to it
+ insertNode(parentElement, node, index)
+
var children = constructChildren(data, node, cached, editable,
namespace, configs)
@@ -1412,7 +1446,7 @@ exports.System = System;
controllers)
}
- if (isNew || shouldReattach === true && node != null) {
+ if (!isNew && shouldReattach === true && node != null) {
insertNode(parentElement, node, index)
}
@@ -1531,14 +1565,18 @@ exports.System = System;
}
function copyStyleAttrs(node, dataAttr, cachedAttr) {
- for (var rule in dataAttr) if (hasOwn.call(dataAttr, rule)) {
- if (cachedAttr == null || cachedAttr[rule] !== dataAttr[rule]) {
- node.style[rule] = dataAttr[rule]
+ for (var rule in dataAttr) {
+ if (hasOwn.call(dataAttr, rule)) {
+ if (cachedAttr == null || cachedAttr[rule] !== dataAttr[rule]) {
+ node.style[rule] = dataAttr[rule]
+ }
}
}
- for (rule in cachedAttr) if (hasOwn.call(cachedAttr, rule)) {
- if (!hasOwn.call(dataAttr, rule)) node.style[rule] = ""
+ for (rule in cachedAttr) {
+ if (hasOwn.call(cachedAttr, rule)) {
+ if (!hasOwn.call(dataAttr, rule)) node.style[rule] = ""
+ }
}
}
@@ -1611,7 +1649,7 @@ exports.System = System;
tag,
namespace
) {
- if (!(attrName in cachedAttrs) || (cachedAttr !== dataAttr)) {
+ if (!(attrName in cachedAttrs) || (cachedAttr !== dataAttr) || ($document.activeElement === node)) {
cachedAttrs[attrName] = dataAttr
try {
return setSingleAttr(
@@ -1634,16 +1672,18 @@ exports.System = System;
}
function setAttributes(node, tag, dataAttrs, cachedAttrs, namespace) {
- for (var attrName in dataAttrs) if (hasOwn.call(dataAttrs, attrName)) {
- if (trySetAttr(
- node,
- attrName,
- dataAttrs[attrName],
- cachedAttrs[attrName],
- cachedAttrs,
- tag,
- namespace)) {
- continue
+ for (var attrName in dataAttrs) {
+ if (hasOwn.call(dataAttrs, attrName)) {
+ if (trySetAttr(
+ node,
+ attrName,
+ dataAttrs[attrName],
+ cachedAttrs[attrName],
+ cachedAttrs,
+ tag,
+ namespace)) {
+ continue
+ }
}
}
return cachedAttrs
@@ -1695,9 +1735,41 @@ exports.System = System;
$document.createRange().createContextualFragment(data))
} catch (e) {
parentElement.insertAdjacentHTML("beforeend", data)
+ replaceScriptNodes(parentElement)
}
}
+ // Replace script tags inside given DOM element with executable ones.
+ // Will also check children recursively and replace any found script
+ // tags in same manner.
+ function replaceScriptNodes(node) {
+ if (node.tagName === "SCRIPT") {
+ node.parentNode.replaceChild(buildExecutableNode(node), node)
+ } else {
+ var children = node.childNodes
+ if (children && children.length) {
+ for (var i = 0; i < children.length; i++) {
+ replaceScriptNodes(children[i])
+ }
+ }
+ }
+
+ return node
+ }
+
+ // Replace script element with one whose contents are executable.
+ function buildExecutableNode(node){
+ var scriptEl = document.createElement("script")
+ var attrs = node.attributes
+
+ for (var i = 0; i < attrs.length; i++) {
+ scriptEl.setAttribute(attrs[i].name, attrs[i].value)
+ }
+
+ scriptEl.text = node.innerHTML
+ return scriptEl
+ }
+
function injectHTML(parentElement, index, data) {
var nextSibling = parentElement.childNodes[index]
if (nextSibling) {
@@ -1825,7 +1897,7 @@ exports.System = System;
}
m.prop = function (store) {
- if ((store != null && isObject(store) || isFunction(store)) &&
+ if ((store != null && (isObject(store) || isFunction(store)) || ((typeof Promise !== "undefined") && (store instanceof Promise))) &&
isFunction(store.then)) {
return propify(store)
}
@@ -1870,7 +1942,11 @@ exports.System = System;
}
m.component = function (component) {
- var args = [].slice.call(arguments, 1)
+ var args = new Array(arguments.length - 1)
+
+ for (var i = 1; i < arguments.length; i++) {
+ args[i - 1] = arguments[i]
+ }
return parameterize(component, args)
}
@@ -1962,7 +2038,7 @@ exports.System = System;
try {
// lastRedrawId is a positive number if a second redraw is requested
// before the next animation frame
- // lastRedrawID is null if it's the first redraw and not an event
+ // lastRedrawId is null if it's the first redraw and not an event
// handler
if (lastRedrawId && !force) {
// when setTimeout: only reschedule redraw if time between now
@@ -2021,7 +2097,7 @@ exports.System = System;
m.withAttr = function (prop, withAttrCallback, callbackThis) {
return function (e) {
- e = e || event
+ e = e || window.event
/* eslint-disable no-invalid-this */
var currentTarget = e.currentTarget || this
var _this = callbackThis || this
@@ -2103,8 +2179,10 @@ exports.System = System;
params = {}
}
- for (var i in args) if (hasOwn.call(args, i)) {
- params[i] = args[i]
+ for (var i in args) {
+ if (hasOwn.call(args, i)) {
+ params[i] = args[i]
+ }
}
var querystring = buildQueryString(params)
@@ -2130,8 +2208,16 @@ exports.System = System;
var method = replaceHistory ? "replaceState" : "pushState"
computePreRedrawHook = setScroll
computePostRedrawHook = function () {
- global.history[method](null, $document.title,
- modes[m.route.mode] + currentRoute)
+ try {
+ global.history[method](null, $document.title,
+ modes[m.route.mode] + currentRoute)
+ } catch (err) {
+ // In the event of a pushState or replaceState failure,
+ // fallback to a standard redirect. This is specifically
+ // to address a Safari security error when attempting to
+ // call pushState more than 100 times.
+ $location[m.route.mode] = currentRoute
+ }
}
redirect(modes[m.route.mode] + currentRoute)
} else {
@@ -2180,29 +2266,31 @@ exports.System = System;
return true
}
- for (var route in router) if (hasOwn.call(router, route)) {
- if (route === path) {
- m.mount(root, router[route])
- return true
- }
-
- var matcher = new RegExp("^" + route
- .replace(/:[^\/]+?\.{3}/g, "(.*?)")
- .replace(/:[^\/]+/g, "([^\\/]+)") + "\/?$")
-
- if (matcher.test(path)) {
- /* eslint-disable no-loop-func */
- path.replace(matcher, function () {
- var keys = route.match(/:[^\/]+/g) || []
- var values = [].slice.call(arguments, 1, -2)
- forEach(keys, function (key, i) {
- routeParams[key.replace(/:|\./g, "")] =
- decodeURIComponent(values[i])
- })
+ for (var route in router) {
+ if (hasOwn.call(router, route)) {
+ if (route === path) {
m.mount(root, router[route])
- })
- /* eslint-enable no-loop-func */
- return true
+ return true
+ }
+
+ var matcher = new RegExp("^" + route
+ .replace(/:[^\/]+?\.{3}/g, "(.*?)")
+ .replace(/:[^\/]+/g, "([^\\/]+)") + "\/?$")
+
+ if (matcher.test(path)) {
+ /* eslint-disable no-loop-func */
+ path.replace(matcher, function () {
+ var keys = route.match(/:[^\/]+/g) || []
+ var values = [].slice.call(arguments, 1, -2)
+ forEach(keys, function (key, i) {
+ routeParams[key.replace(/:|\./g, "")] =
+ decodeURIComponent(values[i])
+ })
+ m.mount(root, router[route])
+ })
+ /* eslint-enable no-loop-func */
+ return true
+ }
}
}
}
@@ -2248,32 +2336,35 @@ exports.System = System;
var duplicates = {}
var str = []
- for (var prop in object) if (hasOwn.call(object, prop)) {
- var key = prefix ? prefix + "[" + prop + "]" : prop
- var value = object[prop]
+ for (var prop in object) {
+ if (hasOwn.call(object, prop)) {
+ var key = prefix ? prefix + "[" + prop + "]" : prop
+ var value = object[prop]
- if (value === null) {
- str.push(encodeURIComponent(key))
- } else if (isObject(value)) {
- str.push(buildQueryString(value, key))
- } else if (isArray(value)) {
- var keys = []
- duplicates[key] = duplicates[key] || {}
- /* eslint-disable no-loop-func */
- forEach(value, function (item) {
- /* eslint-enable no-loop-func */
- if (!duplicates[key][item]) {
- duplicates[key][item] = true
- keys.push(encodeURIComponent(key) + "=" +
- encodeURIComponent(item))
- }
- })
- str.push(keys.join("&"))
- } else if (value !== undefined) {
- str.push(encodeURIComponent(key) + "=" +
- encodeURIComponent(value))
+ if (value === null) {
+ str.push(encodeURIComponent(key))
+ } else if (isObject(value)) {
+ str.push(buildQueryString(value, key))
+ } else if (isArray(value)) {
+ var keys = []
+ duplicates[key] = duplicates[key] || {}
+ /* eslint-disable no-loop-func */
+ forEach(value, function (item) {
+ /* eslint-enable no-loop-func */
+ if (!duplicates[key][item]) {
+ duplicates[key][item] = true
+ keys.push(encodeURIComponent(key) + "=" +
+ encodeURIComponent(item))
+ }
+ })
+ str.push(keys.join("&"))
+ } else if (value !== undefined) {
+ str.push(encodeURIComponent(key) + "=" +
+ encodeURIComponent(value))
+ }
}
}
+
return str.join("&")
}
@@ -2481,7 +2572,7 @@ exports.System = System;
m.sync = function (args) {
var deferred = m.deferred()
var outstanding = args.length
- var results = new Array(outstanding)
+ var results = []
var method = "resolve"
function synchronizer(pos, resolved) {
@@ -2510,7 +2601,7 @@ exports.System = System;
function identity(value) { return value }
function handleJsonp(options) {
- var callbackKey = "mithril_callback_" +
+ var callbackKey = options.callbackName || "mithril_callback_" +
new Date().getTime() + "_" +
(Math.round(Math.random() * 1e16)).toString(36)
@@ -2619,9 +2710,9 @@ exports.System = System;
function parameterizeUrl(url, data) {
if (data) {
- url = url.replace(/:[a-z]\w+/gi, function(token){
+ url = url.replace(/:[a-z]\w+/gi, function (token){
var key = token.slice(1)
- var value = data[key]
+ var value = data[key] || token
delete data[key]
return value
})
@@ -2686,6 +2777,7 @@ exports.System = System;
}
} catch (e) {
deferred.reject(e)
+ m.deferred.onerror(e)
} finally {
if (options.background !== true) m.endComputation()
}
@@ -2697,7 +2789,7 @@ exports.System = System;
}
return m
-})
+}); // eslint-disable-line
;
( function _package( factory ){
if( typeof define === 'function' && define.amd ){
@@ -14921,10 +15013,10 @@ return jQuery;
}).call(this);
;
/* ========================================================================
- * Bootstrap: affix.js v3.3.6
+ * Bootstrap: affix.js v3.3.7
* http://getbootstrap.com/javascript/#affix
* ========================================================================
- * Copyright 2011-2015 Twitter, Inc.
+ * Copyright 2011-2016 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
@@ -14950,7 +15042,7 @@ return jQuery;
this.checkPosition()
}
- Affix.VERSION = '3.3.6'
+ Affix.VERSION = '3.3.7'
Affix.RESET = 'affix affix-top affix-bottom'
@@ -15084,10 +15176,10 @@ return jQuery;
}(jQuery);
;
/* ========================================================================
- * Bootstrap: dropdown.js v3.3.6
+ * Bootstrap: dropdown.js v3.3.7
* http://getbootstrap.com/javascript/#dropdowns
* ========================================================================
- * Copyright 2011-2015 Twitter, Inc.
+ * Copyright 2011-2016 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
@@ -15104,7 +15196,7 @@ return jQuery;
$(element).on('click.bs.dropdown', this.toggle)
}
- Dropdown.VERSION = '3.3.6'
+ Dropdown.VERSION = '3.3.7'
function getParent($this) {
var selector = $this.attr('data-target')
@@ -15250,10 +15342,10 @@ return jQuery;
}(jQuery);
;
/* ========================================================================
- * Bootstrap: modal.js v3.3.6
+ * Bootstrap: modal.js v3.3.7
* http://getbootstrap.com/javascript/#modals
* ========================================================================
- * Copyright 2011-2015 Twitter, Inc.
+ * Copyright 2011-2016 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
@@ -15284,7 +15376,7 @@ return jQuery;
}
}
- Modal.VERSION = '3.3.6'
+ Modal.VERSION = '3.3.7'
Modal.TRANSITION_DURATION = 300
Modal.BACKDROP_TRANSITION_DURATION = 150
@@ -15391,7 +15483,9 @@ return jQuery;
$(document)
.off('focusin.bs.modal') // guard against infinite focus loop
.on('focusin.bs.modal', $.proxy(function (e) {
- if (this.$element[0] !== e.target && !this.$element.has(e.target).length) {
+ if (document !== e.target &&
+ this.$element[0] !== e.target &&
+ !this.$element.has(e.target).length) {
this.$element.trigger('focus')
}
}, this))
@@ -15588,11 +15682,11 @@ return jQuery;
}(jQuery);
;
/* ========================================================================
- * Bootstrap: tooltip.js v3.3.6
+ * Bootstrap: tooltip.js v3.3.7
* http://getbootstrap.com/javascript/#tooltip
* Inspired by the original jQuery.tipsy by Jason Frame
* ========================================================================
- * Copyright 2011-2015 Twitter, Inc.
+ * Copyright 2011-2016 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
@@ -15615,7 +15709,7 @@ return jQuery;
this.init('tooltip', element, options)
}
- Tooltip.VERSION = '3.3.6'
+ Tooltip.VERSION = '3.3.7'
Tooltip.TRANSITION_DURATION = 150
@@ -15906,9 +16000,11 @@ return jQuery;
function complete() {
if (that.hoverState != 'in') $tip.detach()
- that.$element
- .removeAttr('aria-describedby')
- .trigger('hidden.bs.' + that.type)
+ if (that.$element) { // TODO: Check whether guarding this code with this `if` is really necessary.
+ that.$element
+ .removeAttr('aria-describedby')
+ .trigger('hidden.bs.' + that.type)
+ }
callback && callback()
}
@@ -15951,7 +16047,10 @@ return jQuery;
// width and height are missing in IE8, so compute them manually; see https://github.com/twbs/bootstrap/issues/14093
elRect = $.extend({}, elRect, { width: elRect.right - elRect.left, height: elRect.bottom - elRect.top })
}
- var elOffset = isBody ? { top: 0, left: 0 } : $element.offset()
+ var isSvg = window.SVGElement && el instanceof window.SVGElement
+ // Avoid using $.offset() on SVGs since it gives incorrect results in jQuery 3.
+ // See https://github.com/twbs/bootstrap/issues/20280
+ var elOffset = isBody ? { top: 0, left: 0 } : (isSvg ? null : $element.offset())
var scroll = { scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop() }
var outerDims = isBody ? { width: $(window).width(), height: $(window).height() } : null
@@ -16067,6 +16166,7 @@ return jQuery;
that.$tip = null
that.$arrow = null
that.$viewport = null
+ that.$element = null
})
}
@@ -16103,10 +16203,10 @@ return jQuery;
}(jQuery);
;
/* ========================================================================
- * Bootstrap: transition.js v3.3.6
+ * Bootstrap: transition.js v3.3.7
* http://getbootstrap.com/javascript/#transitions
* ========================================================================
- * Copyright 2011-2015 Twitter, Inc.
+ * Copyright 2011-2016 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
@@ -16976,7 +17076,6 @@ System.register('flarum/Component', [], function (_export, _context) {
* @param {Array|Object} children
* @public
*/
-
function Component() {
var props = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
var children = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1];
@@ -19694,16 +19793,16 @@ System.register('flarum/components/PermissionDropdown', ['flarum/components/Drop
if (restrictToGroupIds.indexOf(Group.GUEST_ID) !== -1) {
// do nothing
} else if (restrictToGroupIds.indexOf(Group.MEMBER_ID) !== -1) {
- groupIds = groupIds.filter(function (id) {
- return id !== Group.GUEST_ID;
- });
- } else if (groupIds.indexOf(Group.MEMBER_ID) !== -1) {
- groupIds = restrictToGroupIds;
- } else {
- groupIds = restrictToGroupIds.filter(function (id) {
- return groupIds.indexOf(id) !== -1;
- });
- }
+ groupIds = groupIds.filter(function (id) {
+ return id !== Group.GUEST_ID;
+ });
+ } else if (groupIds.indexOf(Group.MEMBER_ID) !== -1) {
+ groupIds = restrictToGroupIds;
+ } else {
+ groupIds = restrictToGroupIds.filter(function (id) {
+ return groupIds.indexOf(id) !== -1;
+ });
+ }
groupIds = filterByRequiredPermissions(groupIds, required);
});
@@ -20967,88 +21066,87 @@ System.register('flarum/components/UploadImageButton', ['flarum/components/Butto
System.register("flarum/extend", [], function (_export, _context) {
"use strict";
+ /**
+ * Extend an object's method by running its output through a mutating callback
+ * every time it is called.
+ *
+ * The callback accepts the method's return value and should perform any
+ * mutations directly on this value. For this reason, this function will not be
+ * effective on methods which return scalar values (numbers, strings, booleans).
+ *
+ * Care should be taken to extend the correct object – in most cases, a class'
+ * prototype will be the desired target of extension, not the class itself.
+ *
+ * @example
+ * extend(Discussion.prototype, 'badges', function(badges) {
+ * // do something with `badges`
+ * });
+ *
+ * @param {Object} object The object that owns the method
+ * @param {String} method The name of the method to extend
+ * @param {function} callback A callback which mutates the method's output
+ */
+ function extend(object, method, callback) {
+ var original = object[method];
+
+ object[method] = function () {
+ for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
+ args[_key] = arguments[_key];
+ }
+
+ var value = original ? original.apply(this, args) : undefined;
+
+ callback.apply(this, [value].concat(args));
+
+ return value;
+ };
+
+ babelHelpers.extends(object[method], original);
+ }
+
+ /**
+ * Override an object's method by replacing it with a new function, so that the
+ * new function will be run every time the object's method is called.
+ *
+ * The replacement function accepts the original method as its first argument,
+ * which is like a call to 'super'. Any arguments passed to the original method
+ * are also passed to the replacement.
+ *
+ * Care should be taken to extend the correct object – in most cases, a class'
+ * prototype will be the desired target of extension, not the class itself.
+ *
+ * @example
+ * override(Discussion.prototype, 'badges', function(original) {
+ * const badges = original();
+ * // do something with badges
+ * return badges;
+ * });
+ *
+ * @param {Object} object The object that owns the method
+ * @param {String} method The name of the method to override
+ * @param {function} newMethod The method to replace it with
+ */
+
+ _export("extend", extend);
+
+ function override(object, method, newMethod) {
+ var original = object[method];
+
+ object[method] = function () {
+ for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
+ args[_key2] = arguments[_key2];
+ }
+
+ return newMethod.apply(this, [original.bind(this)].concat(args));
+ };
+
+ babelHelpers.extends(object[method], original);
+ }
+ _export("override", override);
+
return {
setters: [],
- execute: function () {
- /**
- * Extend an object's method by running its output through a mutating callback
- * every time it is called.
- *
- * The callback accepts the method's return value and should perform any
- * mutations directly on this value. For this reason, this function will not be
- * effective on methods which return scalar values (numbers, strings, booleans).
- *
- * Care should be taken to extend the correct object – in most cases, a class'
- * prototype will be the desired target of extension, not the class itself.
- *
- * @example
- * extend(Discussion.prototype, 'badges', function(badges) {
- * // do something with `badges`
- * });
- *
- * @param {Object} object The object that owns the method
- * @param {String} method The name of the method to extend
- * @param {function} callback A callback which mutates the method's output
- */
- function extend(object, method, callback) {
- var original = object[method];
-
- object[method] = function () {
- for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
- args[_key] = arguments[_key];
- }
-
- var value = original ? original.apply(this, args) : undefined;
-
- callback.apply(this, [value].concat(args));
-
- return value;
- };
-
- babelHelpers.extends(object[method], original);
- }
-
- /**
- * Override an object's method by replacing it with a new function, so that the
- * new function will be run every time the object's method is called.
- *
- * The replacement function accepts the original method as its first argument,
- * which is like a call to 'super'. Any arguments passed to the original method
- * are also passed to the replacement.
- *
- * Care should be taken to extend the correct object – in most cases, a class'
- * prototype will be the desired target of extension, not the class itself.
- *
- * @example
- * override(Discussion.prototype, 'badges', function(original) {
- * const badges = original();
- * // do something with badges
- * return badges;
- * });
- *
- * @param {Object} object The object that owns the method
- * @param {String} method The name of the method to override
- * @param {function} newMethod The method to replace it with
- */
-
- _export("extend", extend);
-
- function override(object, method, newMethod) {
- var original = object[method];
-
- object[method] = function () {
- for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
- args[_key2] = arguments[_key2];
- }
-
- return newMethod.apply(this, [original.bind(this)].concat(args));
- };
-
- babelHelpers.extends(object[method], original);
- }
-
- _export("override", override);
- }
+ execute: function () {}
};
});;
'use strict';
@@ -21592,7 +21690,6 @@ System.register('flarum/Model', [], function (_export, _context) {
* @param {Store} store The data store that this model should be persisted to.
* @public
*/
-
function Model() {
var data = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
var store = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1];
@@ -23429,7 +23526,6 @@ System.register("flarum/utils/ScrollListener", [], function (_export, _context)
* changes.
* @public
*/
-
function ScrollListener(callback) {
babelHelpers.classCallCheck(this, ScrollListener);
@@ -23490,78 +23586,78 @@ System.register("flarum/utils/ScrollListener", [], function (_export, _context)
System.register('flarum/utils/string', [], function (_export, _context) {
"use strict";
+ /**
+ * Truncate a string to the given length, appending ellipses if necessary.
+ *
+ * @param {String} string
+ * @param {Number} length
+ * @param {Number} [start=0]
+ * @return {String}
+ */
+ function truncate(string, length) {
+ var start = arguments.length <= 2 || arguments[2] === undefined ? 0 : arguments[2];
+
+ return (start > 0 ? '...' : '') + string.substring(start, start + length) + (string.length > start + length ? '...' : '');
+ }
+
+ /**
+ * Create a slug out of the given string. Non-alphanumeric characters are
+ * converted to hyphens.
+ *
+ * @param {String} string
+ * @return {String}
+ */
+
+ _export('truncate', truncate);
+
+ function slug(string) {
+ return string.toLowerCase().replace(/[^a-z0-9]/gi, '-').replace(/-+/g, '-').replace(/-$|^-/g, '') || '-';
+ }
+
+ /**
+ * Strip HTML tags and quotes out of the given string, replacing them with
+ * meaningful punctuation.
+ *
+ * @param {String} string
+ * @return {String}
+ */
+
+ _export('slug', slug);
+
+ function getPlainContent(string) {
+ var html = string.replace(/(<\/p>|
)/g, '$1 ').replace(/]*>/ig, ' ');
+
+ var dom = $('