[MediaWiki-l] what hook for adding html right after <body> tag regardless of skin

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

[MediaWiki-l] what hook for adding html right after <body> tag regardless of skin

rkevans
Hello, I'd like to place a small banner stripe div across the top of every wiki page regardless of the skin.
What is the best hook for writing a tiny hook extension in localsettings that can add a little bit of html to evey page regardless of the skin.

Thank you,
-Rich



_______________________________________________
MediaWiki-l mailing list
To unsubscribe, go to:
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|

Re: what hook for adding html right after <body> tag regardless of skin

יגאל חיטרון
Hi.
And indicator does not meet your needs?
Igal (User:IKhitron)


2018-04-30 17:59 GMT+03:00 Evans, Richard K. (GRC-H000) <
[hidden email]>:

> Hello, I'd like to place a small banner stripe div across the top of every
> wiki page regardless of the skin.
> What is the best hook for writing a tiny hook extension in localsettings
> that can add a little bit of html to evey page regardless of the skin.
>
> Thank you,
> -Rich
>
>
>
> _______________________________________________
> MediaWiki-l mailing list
> To unsubscribe, go to:
> https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
>
_______________________________________________
MediaWiki-l mailing list
To unsubscribe, go to:
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|

Re: what hook for adding html right after <body> tag regardless of skin

rkevans
I admit I haven't used them before, but aren't Page Indicators added manually per-page?

-Rich
_______________________________________________
MediaWiki-l mailing list
To unsubscribe, go to:
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|

Re: what hook for adding html right after <body> tag regardless of skin

יגאל חיטרון
Yes, but it's just html code:
<div class="mw-indicators mw-body-content">
<div id="some-id" class="mw-indicator">
some-content
</div>
</div>
Igal


2018-04-30 20:07 GMT+03:00 Evans, Richard K. (GRC-H000) <
[hidden email]>:

> I admit I haven't used them before, but aren't Page Indicators added
> manually per-page?
>
> -Rich
> _______________________________________________
> MediaWiki-l mailing list
> To unsubscribe, go to:
> https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
>
_______________________________________________
MediaWiki-l mailing list
To unsubscribe, go to:
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|

Re: what hook for adding html right after <body> tag regardless of skin

Greg Rundlett (freephile)
Rich,

If your needs are fairly basic, you could easily do something with
MediaWiki:Common.js
<https://www.mediawiki.org/wiki/Adding_HTML_to_wiki_pages> (Interface/JS
<https://www.mediawiki.org/wiki/Manual:Interface/JavaScript>) to inject a
new element wiki-wide. (Note that if you want the elements to appear
"natural" like the rest of your wiki User Interface, you should look at OOUI
<https://www.mediawiki.org/wiki/OOUI> where you'd probably want to
implement a "panel". See
https://www.mediawiki.org/wiki/OOUI/Using_OOUI_in_MediaWiki)

There are a bunch of examples of directly injecting external JS and code
via the built-in ResourceLoader and in
https://www.mediawiki.org/wiki/ResourceLoader/Core_modules

And, although Page Indicators are the right way to add certain elements to
the top of the page, you can also use Snippets like
https://www.mediawiki.org/wiki/Snippets/Top_icons

If you need a solution that on-wiki admins would be able to manage, you
could use Extension:AdManager
<https://www.mediawiki.org/wiki/Extension:AdManager> (written by Ike Hecht)
and just put your HTML into $wgAdManagerCode plus style it (using
MediaWiki:Common.css) to place the block where you need it. The extension
is used on EyeWiki <http://eyewiki.org/Special:Version> but I didn't find
an example page. Another wiki where it's used is CondoPedia
<http://www.condopedia.com/wiki/Special:Version>; and an example I
found is this
page <http://www.condopedia.com/wiki/15_West_81st_Street>.  The top box
with a photo of Michael Grabelsky is the Ad Code.

If you prefer to roll your own solution, the AdManager extension is one
that uses the prependHTML() method
<https://codesearch.wmflabs.org/search/?q=prependHTML&i=nope&files=&repos=> of
the OutputPage.php <https://www.mediawiki.org/wiki/Manual:OutputPage.php>
 class.


~ Greg

Greg Rundlett
https://eQuality-Tech.com
https://freephile.org

On Mon, Apr 30, 2018 at 1:24 PM, יגאל חיטרון <[hidden email]> wrote:

> Yes, but it's just html code:
> <div class="mw-indicators mw-body-content">
> <div id="some-id" class="mw-indicator">
> some-content
> </div>
> </div>
> Igal
>
>
> 2018-04-30 20:07 GMT+03:00 Evans, Richard K. (GRC-H000) <
> [hidden email]>:
>
> > I admit I haven't used them before, but aren't Page Indicators added
> > manually per-page?
> >
> > -Rich
> > _______________________________________________
> > MediaWiki-l mailing list
> > To unsubscribe, go to:
> > https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
> >
> _______________________________________________
> MediaWiki-l mailing list
> To unsubscribe, go to:
> https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
>
_______________________________________________
MediaWiki-l mailing list
To unsubscribe, go to:
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|

Re: what hook for adding html right after <body> tag regardless of skin

rkevans
ok. thanks. I was thinking there might be a hook that executes just before the skin and content is rendered and I wouldn't have to worry about using css to position a <div> that gets placed behind existing top left content (namely the icon and sidebar). If there isn't, then i'll just have to get more clever with the css gymnastics to get the <div> as clickable entity above) the logo <Div> (which is the real problem i'm fighting). Here is the hook extension I am currently using:

$wgHooks['BeforePageDisplay'][] = 'lfMyTopLeftDiv';

function lfMyTopLeftDiv( OutputPage &$out, Skin &$skin ) {

$out->addHTML( "<span style='position:fixed;top:0px;left:0px; z-index:100;'><a href='https://mydomain.org' style='z-index:100;'>X</a></span>" );  

return $out;

}

Again, I wouldn't even be posting about this if the added <span> code were clickable above the logo and sidebar. It's not. It's underneath and superseded by the logo link .. and large positive values of z-index don't seem to be doing what I was hoping it would do.

I'll consider my questions answered as, "While there are lots of ways of getting html added to each page, there is not a hook that executes just after the <body> html is issued."

I am grateful for the responses I have received and I'll tinker with the various options and see what works best for me in the end.

-Rich

________________________________________
From: MediaWiki-l [[hidden email]] on behalf of Greg Rundlett (freephile) [[hidden email]]
Sent: Monday, April 30, 2018 3:53 PM
To: MediaWiki announcements and site admin list
Subject: Re: [MediaWiki-l] what hook for adding html right after <body> tag regardless of skin

Rich,

If your needs are fairly basic, you could easily do something with
MediaWiki:Common.js
<https://www.mediawiki.org/wiki/Adding_HTML_to_wiki_pages> (Interface/JS
<https://www.mediawiki.org/wiki/Manual:Interface/JavaScript>) to inject a
new element wiki-wide. (Note that if you want the elements to appear
"natural" like the rest of your wiki User Interface, you should look at OOUI
<https://www.mediawiki.org/wiki/OOUI> where you'd probably want to
implement a "panel". See
https://www.mediawiki.org/wiki/OOUI/Using_OOUI_in_MediaWiki)

There are a bunch of examples of directly injecting external JS and code
via the built-in ResourceLoader and in
https://www.mediawiki.org/wiki/ResourceLoader/Core_modules

And, although Page Indicators are the right way to add certain elements to
the top of the page, you can also use Snippets like
https://www.mediawiki.org/wiki/Snippets/Top_icons

If you need a solution that on-wiki admins would be able to manage, you
could use Extension:AdManager
<https://www.mediawiki.org/wiki/Extension:AdManager> (written by Ike Hecht)
and just put your HTML into $wgAdManagerCode plus style it (using
MediaWiki:Common.css) to place the block where you need it. The extension
is used on EyeWiki <http://eyewiki.org/Special:Version> but I didn't find
an example page. Another wiki where it's used is CondoPedia
<http://www.condopedia.com/wiki/Special:Version>; and an example I
found is this
page <http://www.condopedia.com/wiki/15_West_81st_Street>.  The top box
with a photo of Michael Grabelsky is the Ad Code.

If you prefer to roll your own solution, the AdManager extension is one
that uses the prependHTML() method
<https://codesearch.wmflabs.org/search/?q=prependHTML&i=nope&files=&repos=> of
the OutputPage.php <https://www.mediawiki.org/wiki/Manual:OutputPage.php>
 class.


~ Greg

Greg Rundlett
https://eQuality-Tech.com
https://freephile.org

On Mon, Apr 30, 2018 at 1:24 PM, יגאל חיטרון <[hidden email]> wrote:

> Yes, but it's just html code:
> <div class="mw-indicators mw-body-content">
> <div id="some-id" class="mw-indicator">
> some-content
> </div>
> </div>
> Igal
>
>
> 2018-04-30 20:07 GMT+03:00 Evans, Richard K. (GRC-H000) <
> [hidden email]>:
>
> > I admit I haven't used them before, but aren't Page Indicators added
> > manually per-page?
> >
> > -Rich
> > _______________________________________________
> > MediaWiki-l mailing list
> > To unsubscribe, go to:
> > https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
> >
> _______________________________________________
> MediaWiki-l mailing list
> To unsubscribe, go to:
> https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
>
_______________________________________________
MediaWiki-l mailing list
To unsubscribe, go to:
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l

_______________________________________________
MediaWiki-l mailing list
To unsubscribe, go to:
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|

Re: what hook for adding html right after <body> tag regardless of skin

Brian Wolff
Have you considered the SiteNoticeAfter hook?

--
Brian

On Tue, May 1, 2018 at 1:51 AM, Evans, Richard K. (GRC-H000)
<[hidden email]> wrote:

> ok. thanks. I was thinking there might be a hook that executes just before the skin and content is rendered and I wouldn't have to worry about using css to position a <div> that gets placed behind existing top left content (namely the icon and sidebar). If there isn't, then i'll just have to get more clever with the css gymnastics to get the <div> as clickable entity above) the logo <Div> (which is the real problem i'm fighting). Here is the hook extension I am currently using:
>
> $wgHooks['BeforePageDisplay'][] = 'lfMyTopLeftDiv';
>
> function lfMyTopLeftDiv( OutputPage &$out, Skin &$skin ) {
>
> $out->addHTML( "<span style='position:fixed;top:0px;left:0px; z-index:100;'><a href='https://mydomain.org' style='z-index:100;'>X</a></span>" );
>
> return $out;
>
> }
>
> Again, I wouldn't even be posting about this if the added <span> code were clickable above the logo and sidebar. It's not. It's underneath and superseded by the logo link .. and large positive values of z-index don't seem to be doing what I was hoping it would do.
>
> I'll consider my questions answered as, "While there are lots of ways of getting html added to each page, there is not a hook that executes just after the <body> html is issued."
>
> I am grateful for the responses I have received and I'll tinker with the various options and see what works best for me in the end.
>
> -Rich
>
> ________________________________________
> From: MediaWiki-l [[hidden email]] on behalf of Greg Rundlett (freephile) [[hidden email]]
> Sent: Monday, April 30, 2018 3:53 PM
> To: MediaWiki announcements and site admin list
> Subject: Re: [MediaWiki-l] what hook for adding html right after <body> tag regardless of skin
>
> Rich,
>
> If your needs are fairly basic, you could easily do something with
> MediaWiki:Common.js
> <https://www.mediawiki.org/wiki/Adding_HTML_to_wiki_pages> (Interface/JS
> <https://www.mediawiki.org/wiki/Manual:Interface/JavaScript>) to inject a
> new element wiki-wide. (Note that if you want the elements to appear
> "natural" like the rest of your wiki User Interface, you should look at OOUI
> <https://www.mediawiki.org/wiki/OOUI> where you'd probably want to
> implement a "panel". See
> https://www.mediawiki.org/wiki/OOUI/Using_OOUI_in_MediaWiki)
>
> There are a bunch of examples of directly injecting external JS and code
> via the built-in ResourceLoader and in
> https://www.mediawiki.org/wiki/ResourceLoader/Core_modules
>
> And, although Page Indicators are the right way to add certain elements to
> the top of the page, you can also use Snippets like
> https://www.mediawiki.org/wiki/Snippets/Top_icons
>
> If you need a solution that on-wiki admins would be able to manage, you
> could use Extension:AdManager
> <https://www.mediawiki.org/wiki/Extension:AdManager> (written by Ike Hecht)
> and just put your HTML into $wgAdManagerCode plus style it (using
> MediaWiki:Common.css) to place the block where you need it. The extension
> is used on EyeWiki <http://eyewiki.org/Special:Version> but I didn't find
> an example page. Another wiki where it's used is CondoPedia
> <http://www.condopedia.com/wiki/Special:Version>; and an example I
> found is this
> page <http://www.condopedia.com/wiki/15_West_81st_Street>.  The top box
> with a photo of Michael Grabelsky is the Ad Code.
>
> If you prefer to roll your own solution, the AdManager extension is one
> that uses the prependHTML() method
> <https://codesearch.wmflabs.org/search/?q=prependHTML&i=nope&files=&repos=> of
> the OutputPage.php <https://www.mediawiki.org/wiki/Manual:OutputPage.php>
>  class.
>
>
> ~ Greg
>
> Greg Rundlett
> https://eQuality-Tech.com
> https://freephile.org
>
> On Mon, Apr 30, 2018 at 1:24 PM, יגאל חיטרון <[hidden email]> wrote:
>
>> Yes, but it's just html code:
>> <div class="mw-indicators mw-body-content">
>> <div id="some-id" class="mw-indicator">
>> some-content
>> </div>
>> </div>
>> Igal
>>
>>
>> 2018-04-30 20:07 GMT+03:00 Evans, Richard K. (GRC-H000) <
>> [hidden email]>:
>>
>> > I admit I haven't used them before, but aren't Page Indicators added
>> > manually per-page?
>> >
>> > -Rich
>> > _______________________________________________
>> > MediaWiki-l mailing list
>> > To unsubscribe, go to:
>> > https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
>> >
>> _______________________________________________
>> MediaWiki-l mailing list
>> To unsubscribe, go to:
>> https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
>>
> _______________________________________________
> MediaWiki-l mailing list
> To unsubscribe, go to:
> https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
>
> _______________________________________________
> MediaWiki-l mailing list
> To unsubscribe, go to:
> https://lists.wikimedia.org/mailman/listinfo/mediawiki-l

_______________________________________________
MediaWiki-l mailing list
To unsubscribe, go to:
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l