2
0
Эх сурвалжийг харах

Got namespace handling completely done in PHP. Removed JS patch.

Jamie Thingelstad 12 жил өмнө
parent
commit
547f43ea76

+ 7 - 2
Foreground.skin.php

@@ -127,8 +127,13 @@ class foregroundTemplate extends BaseTemplate {
 						</ul>
 					<?php endif;
 					$namespace = str_replace('_', ' ', $this->getSkin()->getTitle()->getNsText());
-					if (!empty($namespace)) { ?><h4 class="namespace label"><?php print $namespace; ?></h4><?php } ?>
-					<h2 class="title"><?php $this->html('title') ?></h2>
+					$displaytitle = $this->data['title'];
+					if (!empty($namespace)) { 
+						$pagetitle = $this->getSkin()->getTitle();
+						$newtitle = str_replace($namespace.':', '', $pagetitle);
+						$displaytitle = str_replace($pagetitle, $newtitle, $displaytitle);
+					?><h4 class="namespace label"><?php print $namespace; ?></h4><?php } ?>
+					<h2 class="title"><?php print $displaytitle; ?></h2>
 					<?php if ( $this->data['isarticle'] ) { ?><h3 id="siteSub"><?php $this->msg( 'tagline' ) ?></h3><?php } ?>
 					<h5 class="subtitle"><?php $this->html('subtitle') ?></h5>
 					<div class="clear_both"></div>

+ 1 - 9
assets/scripts/foreground.js

@@ -23,14 +23,6 @@ jQuery(document).ready(function() {
   jQuery('li#t-smwbrowselink a').addClass('icon-eye-open').text(' ' + jQuery('li#t-smwbrowselink a').text());
 
 
-
-  // Remove Namespaces from Pages Titles
-  if ( jQuery("h4.namespace").length) {
-    var $namespace = jQuery("h4.namespace").text() + ":";
-    jQuery('h2.title').text( jQuery('h2.title').text().replace($namespace,'') );
-  }
-
-
   // Turn categories into labels
   jQuery('#mw-normal-catlinks ul li a').addClass('label');
 
@@ -42,4 +34,4 @@ jQuery(document).ready(function() {
     jQuery('ul#drop1').removeClass('open').css('top', '-9999px').css('left', '785px');
   });
 
-});
+});