2020-01-09 22:11:00 +00:00
import mustache from 'mustache' ;
2020-04-07 23:21:20 +00:00
import { vectorMenuTemplate as portalTemplate } from './MenuDropdown.stories.data' ;
2021-02-08 23:10:21 +00:00
import { placeholder , htmlUserLanguageAttributes , portletAfter } from './utils' ;
2020-01-09 22:11:00 +00:00
2020-03-09 18:31:36 +00:00
/ * *
2020-04-07 23:21:20 +00:00
* @ param { MenuDefinition } data
2020-03-09 18:31:36 +00:00
* @ return { HTMLElement }
* /
2020-02-14 20:33:54 +00:00
export const wrapPortlet = ( data ) => {
2020-01-09 22:11:00 +00:00
const node = document . createElement ( 'div' ) ;
node . setAttribute ( 'id' , 'mw-panel' ) ;
node . innerHTML = mustache . render ( portalTemplate , data ) ;
return node ;
} ;
2020-04-07 23:21:20 +00:00
/ * *
* @ type { Object . < string , MenuDefinition > }
* /
2020-02-14 20:33:54 +00:00
export const PORTALS = {
example : {
2020-04-07 23:21:20 +00:00
id : 'p-example' ,
class : 'vector-menu-portal portal' ,
2020-01-09 22:11:00 +00:00
'html-tooltip' : 'Message tooltip-p-example acts as tooltip' ,
2020-04-07 23:21:20 +00:00
label : 'Portal title' ,
2020-07-14 21:40:28 +00:00
'html-user-language-attributes' : htmlUserLanguageAttributes ,
2020-04-07 23:21:20 +00:00
'html-items' : `
2020-01-09 22:11:00 +00:00
< li > < a href = '#' > A list of links < / a > < / l i >
< li > < a href = '#' > with ids < / a > < / l i >
< li > < a href = '#' > on each list item < / a > < / l i >
2020-04-07 23:21:20 +00:00
` ,
2020-01-09 22:11:00 +00:00
'html-after-portal' : portletAfter (
2021-06-22 14:58:31 +00:00
placeholder ( ` <p>Beware: The <a href="https://codesearch.wmcloud.org/search/?q=SkinAfterPortlet&i=nope&files=&repos=">SkinAfterPortlet hook</a>
can be used to inject arbitary HTML here for any portlet . < / p > ` , 6 0 )
2020-01-09 22:11:00 +00:00
)
2020-02-14 20:33:54 +00:00
} ,
navigation : {
2020-04-07 23:21:20 +00:00
id : 'p-navigation' ,
2020-09-04 19:18:57 +00:00
class : 'vector-menu-portal portal' ,
2020-03-09 18:31:36 +00:00
'html-tooltip' : 'A message tooltip-p-navigation must exist for this to appear' ,
2020-04-07 23:21:20 +00:00
label : 'Navigation' ,
2020-07-14 21:40:28 +00:00
'html-user-language-attributes' : htmlUserLanguageAttributes ,
2020-04-07 23:21:20 +00:00
'html-items' : `
2020-01-09 22:11:00 +00:00
< li id = "n-mainpage-description" > < a href = "/wiki/Main_Page" title = "Visit the main page [⌃⌥z]" accesskey = "z" > Main page < / a > < / l i > < l i i d = " n - c o n t e n t s " > < a h r e f = " / w i k i / W i k i p e d i a : C o n t e n t s " t i t l e = " G u i d e s t o b r o w s i n g W i k i p e d i a " > C o n t e n t s < / a > < / l i > < l i i d = " n - f e a t u r e d c o n t e n t " > < a h r e f = " / w i k i / W i k i p e d i a : F e a t u r e d _ c o n t e n t " t i t l e = " F e a t u r e d c o n t e n t – t h e b e s t o f W i k i p e d i a " > F e a t u r e d c o n t e n t < / a > < / l i > < l i i d = " n - c u r r e n t e v e n t s " > < a h r e f = " / w i k i / P o r t a l : C u r r e n t _ e v e n t s " t i t l e = " F i n d b a c k g r o u n d i n f o r m a t i o n o n c u r r e n t e v e n t s " > C u r r e n t e v e n t s < / a > < / l i > < l i i d = " n - r a n d o m p a g e " > < a h r e f = " / w i k i / S p e c i a l : R a n d o m " t i t l e = " L o a d a r a n d o m p a g e [ ⌃ ⌥ x ] " a c c e s s k e y = " x " > R a n d o m p a g e < / a > < / l i > < l i i d = " n - s i t e s u p p o r t " > < a h r e f = " h t t p s : / / d o n a t e . w i k i m e d i a . o r g / w i k i / S p e c i a l : F u n d r a i s e r R e d i r e c t o r ? u t m _ s o u r c e = d o n a t e & a m p ; u t m _ m e d i u m = s i d e b a r & a m p ; u t m _ c a m p a i g n = C 1 3 _ e n . w i k i p e d i a . o r g & a m p ; u s e l a n g = e n " t i t l e = " S u p p o r t u s " > D o n a t e < / a > < / l i > < l i i d = " n - s h o p l i n k " > < a h r e f = " / / s h o p . w i k i m e d i a . o r g " t i t l e = " V i s i t t h e W i k i p e d i a s t o r e " > W i k i p e d i a s t o r e < / a > < / l i >
2020-04-07 23:21:20 +00:00
` ,
2020-01-09 22:11:00 +00:00
'html-after-portal' : portletAfter ( placeholder ( 'Possible hook output (navigation)' , 50 ) )
2020-02-14 20:33:54 +00:00
} ,
toolbox : {
2020-04-07 23:21:20 +00:00
id : 'p-tb' ,
class : 'vector-menu-portal portal' ,
2020-01-09 22:11:00 +00:00
'html-tooltip' : 'A message tooltip-p-tb must exist for this to appear' ,
2020-04-07 23:21:20 +00:00
label : 'Tools' ,
2020-07-14 21:40:28 +00:00
'html-user-language-attributes' : htmlUserLanguageAttributes ,
2020-04-07 23:21:20 +00:00
'html-items' : `
2020-01-09 22:11:00 +00:00
< li id = "t-whatlinkshere" > < a href = "/wiki/Special:WhatLinksHere/Spain" title = "A list of all wiki pages that link here [⌃⌥j]" accesskey = "j" > What links here < / a > < / l i > < l i i d = " t - r e c e n t c h a n g e s l i n k e d " > < a h r e f = " / w i k i / S p e c i a l : R e c e n t C h a n g e s L i n k e d / S p a i n " r e l = " n o f o l l o w " t i t l e = " R e c e n t c h a n g e s i n p a g e s l i n k e d f r o m t h i s p a g e [ ⌃ ⌥ k ] " a c c e s s k e y = " k " > R e l a t e d c h a n g e s < / a > < / l i > < l i i d = " t - u p l o a d " > < a h r e f = " / w i k i / W i k i p e d i a : F i l e _ U p l o a d _ W i z a r d " t i t l e = " U p l o a d f i l e s [ ⌃ ⌥ u ] " a c c e s s k e y = " u " > U p l o a d f i l e < / a > < / l i > < l i i d = " t - s p e c i a l p a g e s " > < a h r e f = " / w i k i / S p e c i a l : S p e c i a l P a g e s " t i t l e = " A l i s t o f a l l s p e c i a l p a g e s [ ⌃ ⌥ q ] " a c c e s s k e y = " q " > S p e c i a l p a g e s < / a > < / l i > < l i i d = " t - p e r m a l i n k " > < a h r e f = " / w / i n d e x . p h p ? t i t l e = S p a i n & a m p ; o l d i d = 9 3 5 0 8 7 2 4 3 " t i t l e = " P e r m a n e n t l i n k t o t h i s r e v i s i o n o f t h e p a g e " > P e r m a n e n t l i n k < / a > < / l i > < l i i d = " t - i n f o " > < a h r e f = " / w / i n d e x . p h p ? t i t l e = S p a i n & a m p ; a c t i o n = i n f o " t i t l e = " M o r e i n f o r m a t i o n a b o u t t h i s p a g e " > P a g e i n f o r m a t i o n < / a > < / l i > < l i i d = " t - w i k i b a s e " > < a h r e f = " h t t p s : / / w w w . w i k i d a t a . o r g / w i k i / S p e c i a l : E n t i t y P a g e / Q 2 9 " t i t l e = " L i n k t o c o n n e c t e d d a t a r e p o s i t o r y i t e m [ ⌃ ⌥ g ] " a c c e s s k e y = " g " > W i k i d a t a i t e m < / a > < / l i > < l i i d = " t - c i t e " > < a h r e f = " / w / i n d e x . p h p ? t i t l e = S p e c i a l : C i t e T h i s P a g e & a m p ; p a g e = S p a i n & a m p ; i d = 9 3 5 0 8 7 2 4 3 " t i t l e = " I n f o r m a t i o n o n h o w t o c i t e t h i s p a g e " > C i t e t h i s p a g e < / a > < / l i >
2020-04-07 23:21:20 +00:00
` ,
2020-01-09 22:11:00 +00:00
'html-after-portal' : portletAfter ( placeholder ( 'Possible hook output (tb)' , 50 ) )
2020-02-14 20:33:54 +00:00
} ,
langlinks : {
2020-04-07 23:21:20 +00:00
id : 'p-lang' ,
class : 'vector-menu-portal portal' ,
2020-01-09 22:11:00 +00:00
'html-tooltip' : 'A message tooltip-p-lang must exist for this to appear' ,
2020-04-07 23:21:20 +00:00
label : 'In other languages' ,
2020-07-14 21:40:28 +00:00
'html-user-language-attributes' : htmlUserLanguageAttributes ,
2020-04-07 23:21:20 +00:00
'html-items' : `
2020-01-09 22:11:00 +00:00
< li class = "interlanguage-link interwiki-ace" >
< a href = "https://ace.wikipedia.org/wiki/Seupanyo"
title = "Seupanyo – Achinese" lang = "ace" hreflang = "ace" class = "interlanguage-link-target" > Acèh < / a >
2021-12-25 12:08:46 +00:00
< /li><li class="interlanguage-link interwiki-kbd"><a href="https:/ / kbd . wikipedia . org / wiki / % D0 % AD % D1 % 81 % D0 % BF % D0 % B0 % D0 % BD % D0 % B8 % D1 % 8 D " title=" Эспаниэ – Kabardian " lang=" kbd " hreflang=" kbd " class=" interlanguage - link - target ">Адыгэбзэ</a></li><li class=" interlanguage - link interwiki - ady "><a href=" https : //ady.wikipedia.org/wiki/%D0%98%D1%81%D0%BF%D0%B0%D0%BD%D0%B8%D0%B5" title="Испание – Adyghe" lang="ady" hreflang="ady" class="interlanguage-link-target">Адыгабзэ</a></li><li class="interlanguage-link interwiki-af"><a href="https://af.wikipedia.org/wiki/Spanje" title="Spanje – Afrikaans" lang="af" hreflang="af" class="interlanguage-link-target">Afrikaans</a></li><li class="interlanguage-link interwiki-ak"><a href="https://ak.wikipedia.org/wiki/Spain" title="Spain – Akan" lang="ak" hreflang="ak" class="interlanguage-link-target">Akan</a></li><li class="interlanguage-link interwiki-als"><a href="https://als.wikipedia.org/wiki/Spanien" title="Spanien – Alemannisch" lang="gsw" hreflang="gsw" class="interlanguage-link-target">Alemannisch</a></li><li class="interlanguage-link interwiki-am"><a href="https://am.wikipedia.org/wiki/%E1%8A%A5%E1%88%B5%E1%8D%93%E1%8A%95%E1%8B%AB" title="እስፓንያ – Amharic" lang="am" hreflang="am" class="interlanguage-link-target">አማርኛ</a></li><li class="interlanguage-link interwiki-ang"><a href="https://ang.wikipedia.org/wiki/Sp%C4%93onland" title="Spēonland – Old English" lang="ang" hreflang="ang" class="interlanguage-link-target">Ænglisc</a></li><li class="interlanguage-link interwiki-ab"><a href="https://ab.wikipedia.org/wiki/%D0%98%D1%81%D0%BF%D0%B0%D0%BD%D0%B8%D0%B0" title="Испаниа – Abkhazian" lang="ab" hreflang="ab" class="interlanguage-link-target">Аԥсшәа</a></li><li class="interlanguage-link interwiki-ar badge-Q17437798 badge-goodarticle" title="good article"><a href="https://ar.wikipedia.org/wiki/%D8%A5%D8%B3%D8%A8%D8%A7%D9%86%D9%8A%D8%A7" title="إسبانيا – Arabic" lang="ar" hreflang="ar" class="interlanguage-link-target">العربية</a></li><li class="interlanguage-link interwiki-an">
2020-04-07 23:21:20 +00:00
` ,
2020-01-09 22:11:00 +00:00
'html-after-portal' : portletAfter (
` <span class="wb-langlinks-edit wb-langlinks-link"><a href="https://www.wikidata.org/wiki/Special:EntityPage/Q29#sitelinks-wikipedia" title="Edit interlanguage links (provided by WikiBase extension)" class="wbc-editpage">Edit links</a></span></div>
$ { placeholder ( ` <p>Further hook output possible (lang)</p> ` , 60 ) } `
)
2020-02-14 20:33:54 +00:00
} ,
otherProjects : {
2020-04-07 23:21:20 +00:00
id : 'p-wikibase-otherprojects' ,
class : 'vector-menu-portal portal' ,
2020-03-09 18:31:36 +00:00
'html-tooltip' : 'A message tooltip-p-wikibase-otherprojects must exist for this to appear' ,
2020-04-07 23:21:20 +00:00
label : 'In other projects' ,
2020-07-14 21:40:28 +00:00
'html-user-language-attributes' : htmlUserLanguageAttributes ,
2020-04-07 23:21:20 +00:00
'html-items' : `
< li class = "wb-otherproject-link wb-otherproject-commons" > < a href = "https://commons.wikimedia.org/wiki/Category:Spain" hreflang = "en" > Wikimedia Commons < / a > < / l i > < l i c l a s s = " w b - o t h e r p r o j e c t - l i n k w b - o t h e r p r o j e c t - w i k i n e w s " > < a h r e f = " h t t p s : / / e n . w i k i n e w s . o r g / w i k i / C a t e g o r y : S p a i n " h r e f l a n g = " e n " > W i k i n e w s < / a > < / l i > < l i c l a s s = " w b - o t h e r p r o j e c t - l i n k w b - o t h e r p r o j e c t - w i k i q u o t e " > < a h r e f = " h t t p s : / / e n . w i k i q u o t e . o r g / w i k i / S p a i n " h r e f l a n g = " e n " > W i k i q u o t e < / a > < / l i > < l i c l a s s = " w b - o t h e r p r o j e c t - l i n k w b - o t h e r p r o j e c t - w i k i v o y a g e " > < a h r e f = " h t t p s : / / e n . w i k i v o y a g e . o r g / w i k i / S p a i n " h r e f l a n g = " e n " > W i k i v o y a g e < / a > < / l i > ` ,
2020-01-09 22:11:00 +00:00
'html-after-portal' : ''
}
2020-02-14 20:33:54 +00:00
} ;