Initial commit

This commit is contained in:
oldkid 2025-03-26 13:49:40 +01:00
parent 09724f840c
commit 76589c7604
27 changed files with 1174 additions and 0 deletions

108
postbox/README.md Normal file
View file

@ -0,0 +1,108 @@
# Postbox
This is a Friendica add-on that adds a stylesheet to the HEAD element to support showing Postbox styling.
It does not add any interface for creating Postboxes, but users can still create them with BBcode.
_**NOTE:** Support for Postbox is built into Bookface 1.6+. This adddon adds support to Friendica regardless of what theme/scheme is being used._
## Getting started
1. Place the "postbox" folder in your _friendica/addons_ subfolder.
2. Go to the Main _Menu > Admin > Addons_ and enable "Postbox"
3. Any posts using Postbox will now display the colorful backgrounds.
## Using Zen Postbox
1. Open the message Compose modal or Page
2. Type `[class=postbox-red]Wrapped text goes here[/class]` (substitute "-red" with any of the available styles)
3. Press the "Preview" tab to see what it will look like.
While Postbox allows more content than the Facebook version (which is text only), there are limitations due to how Friendica parses BBcode.
**It is STRONGLY recommended you only use Postboxes with text and emoji.**
BBcodes you CANNOT put inside a Postbox:
* [class] (which means you cant nest Postboxes)
* [hr]
* [h1],[h2],[h3], etc…
* [table],[tr],[th],[td]
* [list],[ul],[ol]
* [abstract]
* [spoiler]
* [map]
* [code]
BBcodes that do not work as intended inside a Postbox:
* [pre]
* [noparse]
* [nobb]
The text will show but will be styled and centered.
BBcodes that **CAN BE INSIDE** a Postbox:
* [i], [b], [u], [o], [s] _(bold has no visible effect)_
* [url]
* [img]
* [audio]
* [video]
And any plain text, including emoji
If you are using Markdown formatting what you can and cant put in a Postbox is similar, with the exception that (because of how Markdown is parsed into BBcode) you cant have both a URL and an image in the same Postbox. You *can* however put inline `code` in a Postbox with Markdown where BBcode cannot.
### Available Postbox styles
**Solid Color Backgrounds:**
- .postbox-black
- .postbox-red
- .postbox-green
- .postbox-blue
- .postbox-orange
- .postbox-purple
- .postbox-forest
- .postbox-ocean
- .postbox-pink
- .postbox-salmon
**Gradient Backgrounds:**
- .postbox-darkgray
- .postbox-minty
- .postbox-mintgray
- .postbox-redblue
- .postbox-violets
- .postbox-grayblack
- .postbox-tealblue
- .postbox-greengray
- .postbox-tealgray
- .postbox-bluegray
- .postbox-lavendergray
- .postbox-sunset
- .postbox-sherbert
## Known Issues
- Postboxes are not shown on other platforms when your post is shared.
- Postboxes are not shown in third-party apps (at least none do yet)
## Changelog
1.0 (25 March 2025)
* Initial Release for Friendica 'Interrupted Fern' 2024.12
## Authors and acknowledgment
Random Penguin <https://gitlab.com/randompenguin>
## License
AGPL
## Project status
Unsupported by Friendica devs.

120
postbox/postbox.css Normal file
View file

@ -0,0 +1,120 @@
/* Post Backgrounds
================
Solid and Gradient backgrounds with larger text
to grab reader attention
*/
[class^="postbox-"]{
display: table-cell;
height: 350px;
width: 1000px;
max-width: 100%;
vertical-align: middle;
font-family: Arial, sans-serif;
font-size: 30px;
font-weight: 700;
line-height: 35px;
text-align: center;
padding: 50px 30px;
box-sizing: border-box;
}
[class^="postbox-"] a {
color: inherit !important;
}
[class^="postbox-"]:hover a,
[class^="postbox-"]:focus a {
text-decoration: underline;
}
/* Solid Color Backgrounds */
.postbox-black {
background-color: black;
color: white;
}
.postbox-red {
background-color: rgb(226, 1, 59);
color: white;
}
.postbox-green {
background-color: rgb(38, 146, 127);
color: white;
}
.postbox-blue {
background-color: rgb(32, 136, 175);
color: black;
}
.postbox-orange {
background-color: rgb(255, 99, 35);
color: black;
}
.postbox-purple {
background-color: rgb(115, 33, 173);
color: white;
}
.postbox-forest {
background-color: rgb(22, 83, 72);
color: white;
}
.postbox-ocean {
background-color: rgb(36, 55, 98);
color: white;
}
.postbox-pink {
background-color: rgb(243, 83, 105);
color: black;
}
.postbox-salmon {
background-color: rgb(250, 128, 114);
color: black;
}
/* Gradient Backgrounds */
.postbox-darkgray {
background-image: linear-gradient(135deg, rgb(119, 125, 136), rgb(79, 87, 102));
color: white;
}
.postbox-minty {
background-image: linear-gradient(135deg, rgb(143, 199, 173), rgb(72, 229, 169));
color: black;
}
.postbox-mintgray {
background-image: linear-gradient(135deg, rgb(143, 199, 173), rgb(72, 229, 169));
color: black;
}
.postbox-redblue {
background-image: linear-gradient(45deg, rgb(255, 0, 71), rgb(44, 52, 199));
color: white;
}
.postbox-violets {
background-image: linear-gradient(45deg, rgb(93, 63, 218), rgb(252, 54, 253));
color: white;
}
.postbox-grayblack {
background-image: linear-gradient(45deg, rgb(93, 99, 116), rgb(22, 24, 29));
color: white;
}
.postbox-tealblue {
background-image: linear-gradient(to bottom, #4bdfdf 0%,#207cca 50%,#19094a 100%);
color: white;
}
.postbox-greengray {
background-image: linear-gradient(to right, #c8dbbd 0%,#dedede 100%);
color: black;
}
.postbox-tealgray {
background-image: linear-gradient(to right, #8dcad0 0%,#dedede 100%);
color: black;
}
.postbox-bluegray {
background-image: linear-gradient(to right, #94bbeb 0%,#dedede 100%);
color: black;
}
.postbox-lavendergray {
background-image: linear-gradient(to right, #cfbfda 0%,#dedede 100%);
color: black;
}
.postbox-sunset {
background-image: linear-gradient(to bottom, #fecf41 0%,#fd7440 50%,#b623b1 100%);
color: white;
}
.postbox-sherbert {
background-image: linear-gradient(45deg, #fcd6cd 6%,#f8bc44 25%,#fb7d88 44%,#fb7d88 64%,#fb7d88 64%,#fed640 100%);
color: black;
}

1
postbox/postbox.min.css vendored Normal file
View file

@ -0,0 +1 @@
[class^=postbox-]{display:table-cell;height:350px;width:1000px;max-width:100%;vertical-align:middle;font-family:Arial,sans-serif;font-size:30px;font-weight:700;line-height:35px;text-align:center;padding:50px 30px;box-sizing:border-box}[class^=postbox-] a{color:inherit!important}[class^=postbox-]:focus a,[class^=postbox-]:hover a{text-decoration:underline}.postbox-black{background-color:#000;color:#fff}.postbox-red{background-color:#e2013b;color:#fff}.postbox-green{background-color:#26927f;color:#fff}.postbox-blue{background-color:#2088af;color:#000}.postbox-orange{background-color:#ff6323;color:#000}.postbox-purple{background-color:#7321ad;color:#fff}.postbox-forest{background-color:#165348;color:#fff}.postbox-ocean{background-color:#243762;color:#fff}.postbox-pink{background-color:#f35369;color:#000}.postbox-salmon{background-color:salmon;color:#000}.postbox-darkgray{background-image:linear-gradient(135deg,#777d88,#4f5766);color:#fff}.postbox-mintgray,.postbox-minty{background-image:linear-gradient(135deg,#8fc7ad,#48e5a9);color:#000}.postbox-redblue{background-image:linear-gradient(45deg,#ff0047,#2c34c7);color:#fff}.postbox-violets{background-image:linear-gradient(45deg,#5d3fda,#fc36fd);color:#fff}.postbox-grayblack{background-image:linear-gradient(45deg,#5d6374,#16181d);color:#fff}.postbox-tealblue{background-image:linear-gradient(to bottom,#4bdfdf 0,#207cca 50%,#19094a 100%);color:#fff}.postbox-greengray{background-image:linear-gradient(to right,#c8dbbd 0,#dedede 100%);color:#000}.postbox-tealgray{background-image:linear-gradient(to right,#8dcad0 0,#dedede 100%);color:#000}.postbox-bluegray{background-image:linear-gradient(to right,#94bbeb 0,#dedede 100%);color:#000}.postbox-lavendergray{background-image:linear-gradient(to right,#cfbfda 0,#dedede 100%);color:#000}.postbox-sunset{background-image:linear-gradient(to bottom,#fecf41 0,#fd7440 50%,#b623b1 100%);color:#fff}.postbox-sherbert{background-image:linear-gradient(45deg,#fcd6cd 6%,#f8bc44 25%,#fb7d88 44%,#fb7d88 64%,#fb7d88 64%,#fed640 100%);color:#000}

21
postbox/postbox.php Normal file
View file

@ -0,0 +1,21 @@
<?php
/**
* Name: Postbox
* Description: Adds support for showing Postbox backgrounds but does NOT add an interface for making them (but users can still make them with BBcode)
* Version: 1.0
* Author: Random Penguin <https://gitlab.com/randompenguin>
*/
use Friendica\Core\Hook;
use Friendica\DI;
function postbox_install()
{
Hook::register('head', __FILE__, 'postbox_head');
}
function postbox_head(string &$b)
{
// Add Postbox Styling to Header
$box_styles = __DIR__ . '/postbox.min.css';
DI::page()->registerStylesheet($box_styles);
}