Skip to content

Commit

Permalink
feat: image gallery, longreads (#1257)
Browse files Browse the repository at this point in the history
* v

* v

* Update package.json
  • Loading branch information
maxgithubprofile authored Jul 26, 2024
1 parent be2ca9a commit bfeb6bc
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 3 deletions.
2 changes: 2 additions & 0 deletions css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -5784,6 +5784,7 @@ html.allcontent_application #footerWrapper {
.article_body .article_image img {
border-radius: 5px;
display: block;
cursor: pointer;
}
.article_body .article_image .article_image_caption {
text-align: center;
Expand Down Expand Up @@ -5824,6 +5825,7 @@ html.allcontent_application #footerWrapper {
}
.article_body .article_carousel .img {
background-size: contain!important;
cursor: pointer;
}
.article_body .article_this_embed {
padding: 1.5em;
Expand Down
3 changes: 3 additions & 0 deletions css/main.less
Original file line number Diff line number Diff line change
Expand Up @@ -7055,6 +7055,7 @@ html.allcontent_application{
}

.article_image{

margin-bottom: @rhythm;

&.withBorder{
Expand Down Expand Up @@ -7085,6 +7086,7 @@ html.allcontent_application{
img{
border-radius: 5px;
display: block;
cursor: pointer;
}

.article_image_caption{
Expand Down Expand Up @@ -7134,6 +7136,7 @@ html.allcontent_application{

.img{
background-size: contain!important;
cursor: pointer;
}
}

Expand Down
2 changes: 2 additions & 0 deletions js/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -10285,6 +10285,8 @@ var connectionSpeed = function()
};

replaceArchiveInImage = function(src) {
if(!src) return ''

var srcNew = src;

window.project_config.archivedPeertubeServers.map(server => {
Expand Down
37 changes: 36 additions & 1 deletion js/functionsfirst.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,26 @@ edjsHTMLCnt = function (a, app) {
return ftext
}

var im = {
image: function (e) {

var t = e.data

var src = checkIfAllowedImageApply(trydecode(_.escape(replaceArchiveInImage(t.file && t.file.url ? t.file.url : t.file))))

if(src) return [src]

return []

},

carousel : function(e){
return _.map(e.data, function (i) {
return _.escape(trydecode(i.url))
})
}
}

var e = {
delimiter: function () {
return '<div class="article_delimiter"><i class="fas fa-asterisk"></i><i class="fas fa-asterisk"></i><i class="fas fa-asterisk"></i></div>'
Expand Down Expand Up @@ -462,6 +482,7 @@ edjsHTMLCnt = function (a, app) {
void 0 === n && (n = {});

var i = Object.assign({}, e, n);
var iim = Object.assign({}, im, n);

return {

Expand Down Expand Up @@ -558,7 +579,21 @@ edjsHTMLCnt = function (a, app) {
return t.filter((function (e) {
return !r.includes(e)
}))
}
},

getallimages : function(e){
var result = []

e.blocks.map((function (e) {
var ims = iim[e.type] ? iim[e.type](e) : []

console.log('ims images', ims, iim, e)

result = result.concat(ims)
}))

return result
}
}
};
return r
Expand Down
30 changes: 30 additions & 0 deletions js/satolist.js
Original file line number Diff line number Diff line change
Expand Up @@ -3499,11 +3499,23 @@ Platform = function (app, listofnodes) {
articledecoration : function(wr, share, extend, clbk){
var caption = wr.find('.shareBgCaption')
var capiontextclass = 'caption_small'
var edjs = new edjsHTML(null, app)

var images = edjs.getallimages(share.message)

console.log('images', images)

if(share.caption.length > 10) capiontextclass = 'caption_medium'
if(share.caption.length > 60) capiontextclass = 'caption_long'

var opengallery = function(src){

console.log('iamges opengallery', src)

self.app.platform.ui.images(images, src)

}

caption.addClass(capiontextclass)

if(extend){
Expand Down Expand Up @@ -3532,6 +3544,14 @@ Platform = function (app, listofnodes) {

})

_el.find(".img").on('click', function(){
var src = $(this).attr('i')

if (src){
opengallery(src)
}
})

//self.app.platform.ui.carousel($(this))
})

Expand All @@ -3543,6 +3563,16 @@ Platform = function (app, listofnodes) {
}

})

wr.find('.article_image img').on('click', function(){

var src = $(this).attr('src')

if (src){
opengallery(src)
}

})
}

var cover = share.images[0]
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
"project": "Bastyon",

"version": "0.8.93",
"versionsuffix": "1",
"versionsuffix": "2",
"cordovaversion": "1.8.93",
"cordovaversioncode": "180931",
"cordovaversioncode": "180932",

"description": "Bastyon desktop application",
"author": "Pocketnet Community <[email protected]>",
Expand Down

0 comments on commit bfeb6bc

Please sign in to comment.