28 lines
1.2 KiB
PHP
28 lines
1.2 KiB
PHP
<?php
|
|
/**
|
|
* Name: Link
|
|
* Description: Using short links on whole hub
|
|
* Version: 0.03
|
|
* Author: ivan zlax <@zlax@ussr.win>
|
|
* Maintainer: ivan zlax <@zlax@ussr.win>
|
|
*/
|
|
|
|
use Zotlabs\Lib\Apps;
|
|
use Zotlabs\Extend\Hook;
|
|
use Zotlabs\Extend\Route;
|
|
|
|
function link_load() {
|
|
register_hook('page_end', 'addon/link/link.php', 'link_active');
|
|
Route::register('addon/link/Mod_Link.php','link');
|
|
}
|
|
|
|
function link_unload() {
|
|
unregister_hook('page_end', 'addon/link/link.php', 'link_active');
|
|
Route::unregister('addon/link/Mod_Link.php','link');
|
|
}
|
|
|
|
function link_active(&$a,&$b) {
|
|
// Javascript code for "Link on Hub" button insert - it is not good, it is temporarily, works not good
|
|
$b .= "\n<script>window.onload = function() { let visibleitems = document.querySelectorAll('.btn-group [aria-labelledby]'); for (currentitem of visibleitems) { if (currentitem.getAttribute('aria-labelledby').substr(0,15) == 'wall-item-menu-') currentitem.querySelector('[title=\"Link to Source\"]').outerHTML += '<a class=\"dropdown-item\" href=\"/link/' + currentitem.getAttribute('aria-labelledby').substr(15) + '\" title=\"Link on Hub\"><i class=\"generic-icons-nav fa fa-fw fa-external-link\"></i>Link on Hub</a>';} };</script>\n";
|
|
}
|