Friendica addon that adds the Mahjong Solitaire Game by ffalt (MIT license) as app to Friendica
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.5 KiB

* Name: A Mahjong Solitaire Game
* Description: A Mahjong Solitaire browsergame for your users as time sink. The gamy was developed by ffalt and is MIT licensed.
* Version: 1.1
* Author: Tobias Diekershoff <>
use Friendica\App;
use Friendica\Core\Hook;
use Friendica\Core\Renderer;
use Friendica\DI;
function mahjong_install() {
Hook::register('app_menu', 'addon/mahjong/mahjong.php', 'mahjong_app_menu');
function mahjong_app_menu($a,&$b) {
$b['app_menu'][] = '<div class="app-title"><a href="mahjong">' . DI::l10n()->t('Mahjong Game') . '</a></div>';
function mahjong_module() {
function mahjong_content(&$a) {
$basepath = DI::baseUrl()->get() . '/addon/mahjong/dist';
$o = '';
$o .= <<< EOT
<div class="loading">
LOAD "Mah Jong",8,1<br>LOADING…<br>
<i class="icon-spin1 animate-spin"></i>
$o .= '<div id="mahcredits">' . DI::l10n()->t('Game credits: %smah - Mahjong Solitaire Game%s by ffalt (MIT license).', '<a href="" target="_new">', '</a>') . '</div>';
DI::page()['htmlhead'] .= '<script src="'.$basepath.'/runtime.js" type="module"></script>';
DI::page()['htmlhead'] .= '<script src="'.$basepath.'/polyfills.js" type="module"></script>';
DI::page()['htmlhead'] .= '<script src="'.$basepath.'/main.js" type="module"></script>';
DI::page()->registerStylesheet(__DIR__ . '/mahjong.css');
return $o;