User:Year2000Prob/Y2P
Appearance
I'm working on a MediaWiki framework called Y2P. All you need to use it is this code:
// Y2P MediaWiki Framework var Y2P = new Object(); importScript("User:Y2K/Y2P.MediaWiki.js"); importScript("User:Y2K/Y2P.Debug.js"); // optional; enables debug features; shows errors when they occur
Y2P.MediaWiki.AddPortlet(Id, Name)
- Very similar functionality to
topaz.wputil.addsidepanel()
. - Adds a new portlet to the sidebar on the left.
- Example
- Using the code:
Y2P.MediaWiki.AddPortlet("p-extlinks", "external links");
- will generate:
<div id="p-extlinks" class="portlet"> <h5>external links</h5> <div class="pBody"> <ul> </ul></div></div>
- and put it in the sidebar underneath the others.
Y2P.MediaWiki.AddPortletItem(Items)
- Very similar functionality to
topaz.wputil.addsidepanelbutton()
. - Adds new items to an existing portlet. (Portlets include the tab bar, the personal bar and all the boxes in the left sidebar.)
- Example
- Using the code:
Y2P.MediaWiki.AddPortletItem([ { text: "my monobook js", url: document.getElementById("pt-userpage").childNodes[0].href + "/monobook.js", before: "pt-logout" }, { text: "my monobook css", url: document.getElementById("pt-userpage").childNodes[0].href + "/monobook.css", before: "pt-logout" } ]);
- will generate:
<li><a href="http://wiki.riteme.site/wiki/User:Year2000Prob/monobook.js">my monobook js</a></li> <li><a href="http://wiki.riteme.site/wiki/User:Year2000Prob/monobook.css">my monobook css</a></li>
- and place it in the personal bar in front of the "log out" link.
- NOTE: You only need one parameter out of
overwrite
,before
,addTo
oraddToRaw
to define where the item is placed.
- NOTE: You only need one parameter out of
Full Example
var externallinks = Y2P.MediaWiki.AddPortlet("p-extlinks", "externallinks"); Y2P.MediaWiki.AddPortletItems([ { text: "Joey Joe Joe Junior Shabbadoo's Website", url: "http://www.joeyjoejoejuniorshabbadoo.com/", addToRaw: externallinks }, { text: "#wikipedia", url: function() { window.open( "http://embed.mibbit.com/?channel=%23wikipedia&server=irc.freenode.net%3A6667", "_blank", "width=600&height=380&scrollbars=no&status=no&toolbar=no&location=no&menubar=no&directories=no&resizable=yes" ); }, addToRaw: externallinks } ]);
Generates:
<div id="p-extlinks" class="portlet"> <h5>external links</h5> <div class="pBody"><ul> <li><a href="http://www.joeyjoejoejuniorshabbadoo.com/">Joey Joe Joe Junior Shabbadoo's Website</a></li> <li><a onclick="function(){window.open("http://embed.mibbit.com/?channel=%23wikipedia&server=irc.freenode.net%3A6667","_blank","width=600&height=380&scrollbars=no&status=no&toolbar=no&location=no&menubar=no&directories=no&resizable=yes")};" href="javascript:void(0)">#wikipedia</a></li> </ul></div></div>