my $wgHooks['SkinTemplateNavigation'] broke again

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

my $wgHooks['SkinTemplateNavigation'] broke again

jidanni
Something changed this month in git making this not work anymore,

function JidanniLessRedNavigation($sktemplate,$links){
  foreach($links['namespaces'] as $ns=>&$value){
    if($value['context']=='talk' && $value['class']=='new' && !$sktemplate->getTitle()->quickUserCan('createtalk')){
      unset($links['namespaces'][$ns]);}
    if($ns=='category' && $value['class']=='selected new'){
      $value['class']='selected';
      if(isset($links['actions']['watch'])){unset($links['actions']['watch']);}}}
  return true;}
$wgHooks['SkinTemplateNavigation'][]='JidanniLessRedNavigation';

Maybe I should just give up on trying to use this as the internals it
depends on keep on getting changed.

_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: my $wgHooks['SkinTemplateNavigation'] broke again

Daniel Friesen-2
On Mon, 01 Oct 2012 04:39:59 -0700, <[hidden email]> wrote:

> Something changed this month in git making this not work anymore,
>
> function JidanniLessRedNavigation($sktemplate,$links){
>   foreach($links['namespaces'] as $ns=>&$value){
>     if($value['context']=='talk' && $value['class']=='new' &&  
> !$sktemplate->getTitle()->quickUserCan('createtalk')){
>       unset($links['namespaces'][$ns]);}
>     if($ns=='category' && $value['class']=='selected new'){
>       $value['class']='selected';
>       if(isset($links['actions']['watch'])){unset($links['actions']['watch']);}}}
>   return true;}
> $wgHooks['SkinTemplateNavigation'][]='JidanniLessRedNavigation';
>
> Maybe I should just give up on trying to use this as the internals it
> depends on keep on getting changed.

Wait, all you've been doing this tim is removing redlinks... why don't you  
just use css for that?

--
~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://daniel.friesen.name]


_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: my $wgHooks['SkinTemplateNavigation'] broke again

Antoine Musso-3
Le 01/10/12 16:50, Daniel Friesen a écrit :
> Wait, all you've been doing this tim is removing redlinks... why don't
> you just use css for that?

That will not work on text browsers which is what Jidanni uses.

--
Antoine "hashar" Musso


_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: my $wgHooks['SkinTemplateNavigation'] broke again

bawolff
On Mon, Oct 1, 2012 at 2:59 PM, Antoine Musso <[hidden email]> wrote:

> Le 01/10/12 16:50, Daniel Friesen a écrit :
>> Wait, all you've been doing this tim is removing redlinks... why don't
>> you just use css for that?
>
> That will not work on text browsers which is what Jidanni uses.
>
> --
> Antoine "hashar" Musso
>
>
> _______________________________________________
> Wikitech-l mailing list
> [hidden email]
> https://lists.wikimedia.org/mailman/listinfo/wikitech-l

In which case the links wouldn't be red in the first place :P

-bawolff

_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: my $wgHooks['SkinTemplateNavigation'] broke again

jidanni
I would be happy to use CSS, just tell me how to rewrite the final
function of

$wgNamespaceProtection[NS_CATEGORY]=$wgNamespaceProtection[NS_CATEGORY_TALK]=array('editinterface');
function JidanniBlueLinkCategoryPages($linker,$target,&$text,&$customAttribs,&$query,&$options){
  switch($target->getNamespace()){case NS_CATEGORY:case NS_CATEGORY_TALK:$options[0]='known';}return true;}
$wgHooks['LinkBegin'][]='JidanniBlueLinkCategoryPages';
function JidanniDontInviteEdit(&$article,&$outputDone){if($article->getID()===0){
    switch($article->getTitle()->getNamespace()){case NS_CATEGORY:case NS_CATEGORY_TALK:$outputDone=true;}}return true;}
$wgHooks['ArticleViewHeader'][]='JidanniDontInviteEdit';//Bug 17630
function JidanniLessRedNavigation($sktemplate,$links){
  foreach($links['namespaces'] as $ns=>&$value){
    if($value['context']=='talk' && $value['class']=='new' && !$sktemplate->getTitle()->quickUserCan('createtalk')){
      unset($links['namespaces'][$ns]);}
    if($ns=='category' && $value['class']=='selected new'){
      $value['class']='selected';
      if(isset($links['actions']['watch'])){unset($links['actions']['watch']);}}}  //var_dump('AFTER',$links);
  return true;}
$wgHooks['SkinTemplateNavigation'][]='JidanniLessRedNavigation';

to make it work again. Thanks.

_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: my $wgHooks['SkinTemplateNavigation'] broke again

Daniel Friesen-2
On Mon, 01 Oct 2012 23:10:11 -0700, <[hidden email]> wrote:

> I would be happy to use CSS, just tell me how to rewrite the final
> function of
>
> $wgNamespaceProtection[NS_CATEGORY]=$wgNamespaceProtection[NS_CATEGORY_TALK]=array('editinterface');
> function  
> JidanniBlueLinkCategoryPages($linker,$target,&$text,&$customAttribs,&$query,&$options){
>   switch($target->getNamespace()){case NS_CATEGORY:case  
> NS_CATEGORY_TALK:$options[0]='known';}return true;}
> $wgHooks['LinkBegin'][]='JidanniBlueLinkCategoryPages';
> function  
> JidanniDontInviteEdit(&$article,&$outputDone){if($article->getID()===0){
>     switch($article->getTitle()->getNamespace()){case NS_CATEGORY:case  
> NS_CATEGORY_TALK:$outputDone=true;}}return true;}
> $wgHooks['ArticleViewHeader'][]='JidanniDontInviteEdit';//Bug 17630
> function JidanniLessRedNavigation($sktemplate,$links){
>   foreach($links['namespaces'] as $ns=>&$value){
>     if($value['context']=='talk' && $value['class']=='new' &&  
> !$sktemplate->getTitle()->quickUserCan('createtalk')){
>       unset($links['namespaces'][$ns]);}
>     if($ns=='category' && $value['class']=='selected new'){
>       $value['class']='selected';
>       if(isset($links['actions']['watch'])){unset($links['actions']['watch']);}}}  
> //var_dump('AFTER',$links);
>   return true;}
> $wgHooks['SkinTemplateNavigation'][]='JidanniLessRedNavigation';
>
> to make it work again. Thanks.

We're saying you don't need to rewrite it.

Assuming you're using Vector. The standard link blue is #0645AD and the  
standard :visited blue is #0B0080.
So to override the .new styles in the personal area with standard colors,  
just use:

#p-personal a.new { color: #0645AD; }
#p-personal a.new:visited { color: #0B0080; }

And you can use that everywhere in your own personal css, not just your  
own wikis.
--
~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://daniel.friesen.name]


_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: my $wgHooks['SkinTemplateNavigation'] broke again

jidanni
I don't want to change link colors.
I want to remove links.

This used to work up until a month ago.
Please tell me what I need to do to make it work again.

Please.

function JidanniLessUselessNavigation($sktemplate,$links){
  foreach($links['namespaces'] as $ns=>&$value){
    if($value['context']=='talk' && $value['class']=='new' && !$sktemplate->getTitle()->quickUserCan('createtalk')){
      unset($links['namespaces'][$ns]);}
    if($ns=='category' && $value['class']=='selected new'){
      $value['class']='selected';
      if(isset($links['actions']['watch'])){unset($links['actions']['watch']);}}}
  return true;}
$wgHooks['SkinTemplateNavigation'][]='JidanniLessUselessNavigation';

Thanks.

_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: my $wgHooks['SkinTemplateNavigation'] broke again

jidanni
In reply to this post by Daniel Friesen-2
It turns out the ($sktemplate,$links) which worked a month ago,
now needs to be (&$sktemplate,&$links)!

_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: my $wgHooks['SkinTemplateNavigation'] broke again

Daniel Friesen-2
On Wed, 10 Oct 2012 02:57:40 -0700, <[hidden email]> wrote:

> It turns out the ($sktemplate,$links) which worked a month ago,
> now needs to be (&$sktemplate,&$links)!

You shouldn't need the & on $sktemplate. But obviously $links needs a &.  
This should have never worked in the first place without that. How do you  
expect to modify the links when you're dealing with a copy?

--
~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://daniel.friesen.name]


_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: my $wgHooks['SkinTemplateNavigation'] broke again

jidanni
>>>>> "DF" == Daniel Friesen <[hidden email]> writes:

DF> obviously $links needs a &. This should have never worked in the
DF> first place without that. How do you expect to modify the links when
DF> you're dealing with a copy?

I don't know but it indeed did until about a month ago.
That's what's in my backups.
Anyway now I use &$ so no more problem.

_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l