mahjong/mahjong.php

43 lines
1.5 KiB
PHP
Raw Normal View History

2022-02-19 10:38:03 +01:00
<?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() {
2022-02-19 10:40:07 +01:00
Hook::register('app_menu', 'addon/mahjong/mahjong.php', 'mahjong_app_menu');
2022-02-19 10:38:03 +01:00
}
function mahjong_app_menu($a,&$b) {
2022-02-19 10:41:44 +01:00
$b['app_menu'][] = '<div class="app-title"><a href="mahjong">' . DI::l10n()->t('Mahjong Game') . '</a></div>';
2022-02-19 10:38:03 +01:00
}
function mahjong_module() {
return;
}
function mahjong_content(&$a) {
2022-02-19 10:43:42 +01:00
$basepath = DI::baseUrl()->get() . '/addon/mahjong/dist';
2022-02-19 10:38:03 +01:00
$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;
2022-02-20 08:08:33 +01:00
$o .= '<div id="mahcredits">' . DI::l10n()->t('Game credits: <a href="%s" target="_new">mah - Mahjong Solitaire Game</a> by ffalt (MIT license).', 'https://github.com/ffalt/mah') . '</div>';
2022-02-19 10:43:42 +01:00
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>';
2022-02-19 10:38:03 +01:00
return $o;
}