2
0
Fork 0

javascript testing button insert

This commit is contained in:
ivan 2020-04-01 00:08:20 +03:00
parent ef486a3ade
commit 34f18e9663
1 changed files with 3 additions and 3 deletions

View File

@ -2,7 +2,7 @@
/** /**
* Name: Link * Name: Link
* Description: Using short links on whole hub * Description: Using short links on whole hub
* Version: 0.03 * Version: 0.04
* Author: ivan zlax <@zlax@ussr.win> * Author: ivan zlax <@zlax@ussr.win>
* Maintainer: ivan zlax <@zlax@ussr.win> * Maintainer: ivan zlax <@zlax@ussr.win>
*/ */
@ -22,6 +22,6 @@ function link_unload() {
} }
function link_active(&$a,&$b) { function link_active(&$a,&$b) {
// Javascript code for "Link on Hub" button insert - it is not good, it is temporarily, works not good // Javascript code for "Link on Hub" button insert - it is not good, it is temporarily, just for testing purposes
$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"; $b .= "\n<script>window.buttonsnotedited = true; setInterval(addButtons, 1000); function addButtons() { if (window.buttonsnotedited == true) { if (loadingPage == false) { 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>';} window.buttonsnotedited = false; } } }</script>\n";
} }