diff --git a/package-lock.json b/package-lock.json
index 25804cb8c..8b02ae803 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -5482,8 +5482,7 @@
"jquery": {
"version": "3.3.1",
"resolved": "https://registry.npmjs.org/jquery/-/jquery-3.3.1.tgz",
- "integrity": "sha512-Ubldcmxp5np52/ENotGxlLe6aGMvmF4R8S6tZjsP6Knsaxd/xp3Zrh50cG93lR6nPXyUFwzN3ZSOQI0wRJNdGg==",
- "dev": true
+ "integrity": "sha512-Ubldcmxp5np52/ENotGxlLe6aGMvmF4R8S6tZjsP6Knsaxd/xp3Zrh50cG93lR6nPXyUFwzN3ZSOQI0wRJNdGg=="
},
"js-base64": {
"version": "2.4.9",
@@ -9431,6 +9430,14 @@
"readable-stream": "^2.0.2"
}
},
+ "readmore-js": {
+ "version": "2.2.1",
+ "resolved": "https://registry.npmjs.org/readmore-js/-/readmore-js-2.2.1.tgz",
+ "integrity": "sha512-hbPP0nQpYYkAywCEZ8ozHivvhWyHic37KJ2IXrHES4qzjp0+nmw8R33MeyMAtXBZfXX4Es8cpd5JBVf9qj47+Q==",
+ "requires": {
+ "jquery": ">2.1.4"
+ }
+ },
"recast": {
"version": "0.11.23",
"resolved": "https://registry.npmjs.org/recast/-/recast-0.11.23.tgz",
diff --git a/package.json b/package.json
index 37244a4ae..8cd0b0c3f 100644
--- a/package.json
+++ b/package.json
@@ -25,6 +25,7 @@
"infinite-scroll": "^3.0.4",
"laravel-echo": "^1.4.0",
"pusher-js": "^4.2.2",
+ "readmore-js": "^2.2.1",
"socket.io-client": "^2.1.1",
"sweetalert": "^2.1.0",
"twitter-text": "^2.0.5",
diff --git a/resources/assets/js/components.js b/resources/assets/js/components.js
index 4f4ceaf16..20305a85b 100644
--- a/resources/assets/js/components.js
+++ b/resources/assets/js/components.js
@@ -2,6 +2,22 @@ window.Vue = require('vue');
import BootstrapVue from 'bootstrap-vue'
Vue.use(BootstrapVue);
+pixelfed.readmore = () => {
+ $(document).find('.read-more').each(function(k,v) {
+ let el = $(this);
+ let attr = el.attr('data-readmore');
+ if(typeof attr !== typeof undefined && attr !== false) {
+ return;
+ }
+ el.readmore({
+ collapsedHeight: 44,
+ heightMargin: 20,
+ moreLink: 'Read more',
+ lessLink: 'Hide',
+ });
+ });
+};
+
window.InfiniteScroll = require('infinite-scroll');
window.filesize = require('filesize');
import swal from 'sweetalert';