Add readmore.js

This commit is contained in:
Daniel Supernault 2018-11-13 12:43:46 -07:00
parent 965fd12e22
commit 06a931c1cb
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7
3 changed files with 26 additions and 2 deletions

11
package-lock.json generated
View file

@ -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",

View file

@ -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",

View file

@ -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: '<a href="#" class="font-weight-bold small">Read more</a>',
lessLink: '<a href="#" class="font-weight-bold small">Hide</a>',
});
});
};
window.InfiniteScroll = require('infinite-scroll');
window.filesize = require('filesize');
import swal from 'sweetalert';