User:Dantman/GE Extended/Extra notes
Wikia - creating communities
Contents |
[edit] Alterations to the Title alterations
I'm considering making some changes to my title changes. While just stripping out a world name is nice, I think I may add some functionality which will make titles look similarly to something like (Example for page Anime:Nanoha/Nanoha Takamichi
Though that's just a stylistic showing of it: The truth is this'll be the title's coding look:
<h1 class="firstHeading" style="margin-bottom: 0px;"><span class="worldLink inWorld"><a href="/wiki/Nanoha">Nanoha</a></span> Nanoha Takamichi</h1> <div id="bodyContent"> <div id="contentSub"> <span class="fullTitle inWorld">From: Nanoha/Nanoha Takamichi</span> <span class="subpages">< <a href="/wiki/Nanoha">Nanoha</a></span> </div>
As you see, the title will feature a extra span called worldLink, this will contain a link to the worldpage of the series. Since the link will only appear when in an actual world, and you might not want some things to show up on worldpages, 2 conditional classes are added after worldLink; inWorld which is set when on a worldpage or subpage, and onWorldpage which is set when on the worldpage (Not a subpage). Using a little css that span can be told to show or hide itself if you are on a worldpage, a world article, or outside of a world. Also the fact that it's a separate span is what allows that > to be added in the demo above, that would be done with CSS.
Another thing added is the fullTitle section. Like worldLink it shares the same conditional classes and shows on all pages. The reason this exists is because of the possible complaint that could be made by advanced editors who commonly use the Title as a way to copy the name of an article so that they can create a link to it without the underscores which are in the address bar. The complaint would be that stripping the world name and / and adding that extra stuff makes it impossible to copy a direct title. For this reason the fullTitle section in the contentSub area is added to display the actual article title. The text of this area is editable at MediaWiki:Fulltitle which defaults to From: $1.
[edit] includes/SkinTemplate.php Changes
143 global $wgArticlePath, $wgScriptPath, $wgServer, $wgLang, $wgCanonicalNamespaceNames;
Should become:
143 global $wgArticlePath, $wgScriptPath, $wgServer, $wgLang, $wgCanonicalNamespaceNames; XXX global $egGE, $action;
193 $tpl->set( 'title', $wgOut->getPageTitle() );
Should become:
193 $tpl->set( 'title', ( $action == 'view' || $action == 'purge' ? '<span class="titleWorldLink '.$egGE->conditionalClasses().'">'.$egGE->worldLink().'</span>' : '' ).htmlspecialchars( $wgOut->getPageTitle() ) );
This will add the span to the start.
Also:
195 $tpl->set( 'displaytitle', $wgOut->mPageLinkTitle );
Becomes:
195 $tpl->set( 'displaytitle', '...'.$wgOut->mPageLinkTitle );
The reason for this is it appears that displaytitle is only used by skins to determine if they should render the title in html or escaped text. Unfortunately at normal times since it's empty, it is rendered escaped. So what we half to do is add text to tell it not to escape the text, and escape the actual title portion ourselves.
213 $tpl->set( 214 'subtitle', !empty($subpagestr)? 215 '<span class="subpages">'.$subpagestr.'</span>'.$out->getSubtitle(): 216 $out->getSubtitle() 217 );
Should become:
213 $tpl->set( 214 'subtitle', '<span class="fullTitle '.$egGE->conditionalClasses().'">'.$egGE->fullTitle().'</span>' . ( !empty($subpagestr)? 215 '<span class="subpages">'.$subpagestr.'</span>'.$out->getSubtitle(): 216 $out->getSubtitle() ) 217 );
[edit] Styles
/* TitleWorldLink style classes -Dantman */
.titleWorldLink,
.titleWorldLink.worldPage,
.titleWorldLink.inWorld.worldPage { display: none; }
.titleWorldLink.inWorld { display: inline; }
.titleWorldLink:after { content: ' > '; }
/* Fulltitle style classes -Dantman */
.fullTitle { font-style: italic; }
[edit] Category Listing
Similarly to above, there's something to note about categorypages. Because of how the title mods work, categorypages will still list articles as Nanoha/Nanoha Takamichi. Unfortunately this may prove to be confusing. I may modify category display to have a small change in it. This will mean that a similar span to worldLink will appear before stripped titles inside of a category page to make things easier to understand. Perhaps that will act as a separate link also.
[edit] includes/Linker.php Changes
Unfortunately we kinda half to alter a core function to get this working right. Happily this function is only called by the includes/CategoryPage.php file which is the only thing we want calling this. (Eclipse's search function searches all the files in the project and no other file has the name of this function.
My override technique has never actually worked (Though theoretically it should be possible). But the way to probably do this the best, is to pass most of the parameters through by reference, adding an extra prepend and append set to alter outside the link, while things the $text parameter can be altered to remove portions.
Old function:
135 function makeSizeLinkObj( $size, $nt, $text = '', $query = '', $trail = '', $prefix = '' ) {
136 global $wgUser;
137 $threshold = intval( $wgUser->getOption( 'stubthreshold' ) );
138 if( $size < $threshold ) {
139 return $this->makeStubLinkObj( $nt, $text, $query, $trail, $prefix );
140 } else {
141 return $this->makeKnownLinkObj( $nt, $text, $query, $trail, $prefix );
142 }
143 }
New Function:
135 function makeSizeLinkObj( $size, $nt, $text = '', $query = '', $trail = '', $prefix = '' ) {
XXX $prepend = '';
XXX $append = '';
XXX wfRunHooks( 'Prepend:makeSizeLinkObj', array( &$prepend, &$append, &$nt, &$text, &$query, &$trail, &$prefix ) );
136 global $wgUser;
137 $threshold = intval( $wgUser->getOption( 'stubthreshold' ) );
138 if( $size < $threshold ) {
139 return $prepend . $this->makeStubLinkObj( $nt, $text, $query, $trail, $prefix ) . $append;
140 } else {
141 return $prepend . $this->makeKnownLinkObj( $nt, $text, $query, $trail, $prefix ) . $append;
142 }
143 }
And the GENetwork extension will handle the rest.
[edit] Styles
/* CategoryWorldLink style classes -Dantman */
.categoryWorldLink,
.categoryWorldLink.worldPage,
.categoryWorldLink.inWorld.worldPage { display: none; }
.categoryWorldLink.inWorld { display: inline; }
.categoryWorldLink:after { content: ' > '; }
[edit] Newskin mods
There is something I kinda like about Newskin. The truth is that that skin starts to make an encyclopedia start to look almost like the other Anime encyclopedias such as ANN's Encyclopedia. Going along with that some also use nice links to link to other encyclopedia. The Social Bookmarking section gave me the idea for this, but I also hope to modify Newskin in a way which allows custom per page links to be added. It'll probably run off hooks and use tags kinda like this:
<sidelink type="ann-anime" title="Extra">1243</sidelink>
The sidelink will use MediaWiki namespace messages to create sidebar links in a custom section. In a manor like this:
- MediaWiki:Sidelink-url-ann-anime would contain:
http://www.animenewsnetwork.com/encyclopedia/anime.php?id=$1
Parameters would be split in sidelink by a | so it would be possible to add other params using $1, $2, etc...
- MediaWiki:Sidelink-text-ann-anime would contain:
ANN's Anime Encyclopedia
That title section you see in the hook would be sent to the sidelink-text-ann-anime message and if the text contained $1 then whatever was entered in title would be added there. Useful if you want individualized links. That text section could also of course contain a embedded image for use as a miniature logo.
[edit] Extra hooks
- The ArticleViewRedirect in includes/Article.php manages redirects. This hook could be useful in the creation of both the regex redirect, and Deep redirect. ~NOTASTAFF Daniel Friesen (DanTMan, Nadir Seen Fire) (talk) (tricks) (current topic) Sep 5, 2007 @ 07:14 (UTC)