1st version of the apps php code

This commit is contained in:
Tobias Diekershoff 2022-02-19 10:38:03 +01:00
parent 01a4bbd1e3
commit 6a1e9a9b2e
1 changed files with 42 additions and 0 deletions

42
mahjong.php Normal file
View File

@ -0,0 +1,42 @@
<?php
/**
* 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.0
* Author: Tobias Diekershoff <https://f.diekershoff.de/u/tobias>
*/
use Friendica\App;
use Friendica\Core\Hook;
use Friendica\Core\Renderer;
use Friendica\DI;
function mahjong_install() {
Hook::register('app_menu', 'addon/mah/mah.php', 'mahjong_app_menu');
}
function mahjong_app_menu($a,&$b) {
$b['app_menu'][] = '<div class="app-title"><a href="mah">' . DI::l10n()->t('Mahjong Game') . '</a><
/div>';
}
function mahjong_module() {
return;
}
function mahjong_content(&$a) {
$basepath = DI::baseUrl()->get() . '/addon/mahjong';
$o = '';
$o .= <<< EOT
<app-root>
<div class="loading">
LOAD "Mah Jong",8,1<br>LOADING…<br>
<i class="icon-spin1 animate-spin"></i>
</div>
</app-root>
EOT;
DI::page()['htmlhead'] .= '<script src="'.$basepath.'/runtime.02c30728ea54f887.js" type="module"></script>';
DI::page()['htmlhead'] .= '<script src="'.$basepath.'/polyfills.3e468d5ab5f409a5.js" type="module"></script>';
DI::page()['htmlhead'] .= '<script src="'.$basepath.'/main.abbf60ddab1c39b5.js" type="module"></script>';
return $o;
}