Gebruiker:Josse.Cottenier/vector.js: verschil tussen versies
Naar navigatie springen
Naar zoeken springen
(Dat zou moeten werken) |
|||
| Regel 1: | Regel 1: | ||
/* JavaScript die hier wordt geplaatst heeft alleen invloed op gebruikers die de skin Vector gebruiken */ | /* JavaScript die hier wordt geplaatst heeft alleen invloed op gebruikers die de skin Vector gebruiken */ | ||
| − | + | /** | |
| + | * Titel_item | ||
| + | * | ||
| + | * Zoek Titel items op (class="Titel_item") (let op de hoofdletter) | ||
| + | * en plaats deze rechts van de titel | ||
| + | * Pas nadat overige titelbewerkingen hebben plaatsgevonden | ||
| + | * (te gebruiken voor bijv. {{Beveiligd}} en {{Semibeveiligd}} zodat deze onder de sluit-knop van de sitenotice komt | ||
| + | */ | ||
| + | function Titel_item() { | ||
| + | var h1 = document.getElementsByTagName("h1")[0]; | ||
| + | var content = document.getElementById("content"); | ||
| + | var icones = document.getElementsByTagName("div"); | ||
| + | var icones2 = new Array(); | ||
| + | var j = 0; | ||
| + | for (var i = 0; i < icones.length; ++i) { | ||
| + | if (icones[i].className == "Titel_item") { | ||
| + | icones2[j++] = icones[i]; | ||
| + | } | ||
| + | } | ||
| + | for (; j > 0; --j) { | ||
| + | icones2[j-1].style.display = "block"; /* annule display:none par défaut */ | ||
| + | icones2[j-1].style.borderWidth = "1px"; | ||
| + | icones2[j-1].style.borderStyle = "solid"; | ||
| + | icones2[j-1].style.borderColor = "white"; | ||
| + | content.insertBefore(icones2[j-1], h1); /* déplacement de l'élément */ | ||
| + | } | ||
| + | } | ||
| + | |||
| + | addOnloadHook(Titel_item); | ||
| + | |||
| + | |||
| + | /* Voor rechterbovenmargesjablonen */ | ||
| + | /* Verbeterde versie, werkt beter dan Titel_item() */ | ||
| + | |||
| + | function Titel_item3() { | ||
| + | var h1 = document.getElementsByTagName("h1")[0]; | ||
| + | var content = document.getElementById("content"); | ||
| + | var icones = document.getElementsByTagName("div"); | ||
| + | var icones2 = new Array(); | ||
| + | var j = 0; | ||
| + | for (var i = 0; i < icones.length; ++i) { | ||
| + | if (icones[i].className == "Titel_item2") { | ||
| + | icones2[j++] = icones[i]; | ||
| + | } | ||
| + | } | ||
| + | for (; j > 0; --j) { | ||
| + | icones2[j-1].className = "Titel_item3"; | ||
| + | if (icones2[j-1].id == "Titelbeveiligd" && wgUserName == null){ | ||
| + | icones2[j-1].style.display = "none"; // titelwijzigingssjabloon alleen voor ingelogde gebruikers | ||
| + | } | ||
| + | content.insertBefore(icones2[j-1], h1); /* Verplaats het element naar de juiste plek */ | ||
| + | } | ||
| + | Titel_toevoegen("templ_Semibeveiligd", h1, content); | ||
| + | Titel_toevoegen("templ_TitelBeveiligd", h1, content); | ||
| + | Titel_toevoegen("templ_Beveiligd", h1, content); | ||
| + | Titel_toevoegen("templ_Commons", h1, content); //staat rechtsboven, wordt geregeld in [[MediaWiki:Sharedupload]] | ||
| + | Titel_toevoegen("templ_Etalage", h1, content); | ||
| + | Titel_toevoegen("templ_Woordenboek", h1, content) | ||
| + | Titel_toevoegen("templ_Coordinaten", h1, content) | ||
| + | } | ||
| + | |||
| + | function Titel_toevoegen(de_div_id, h1, content) { | ||
| + | if (document.getElementById(de_div_id)){ | ||
| + | document.getElementById(de_div_id).className = "Titel_item3"; | ||
| + | content.insertBefore(document.getElementById(de_div_id), h1); /* Verplaats het element naar de juiste plek */ | ||
| + | } | ||
| + | } | ||
| + | |||
| + | addOnloadHook(function(){ Titel_item3(); }); | ||
| + | //div id's aangepast | ||
| + | |||
| + | /** | ||
| + | * Article history link for SpecialAbuseLog | ||
| + | * @author Krinkle | ||
| + | * @revision 4 (2010-01-28) | ||
| + | * @created January 27, 2011 | ||
| + | * @license This script is released in the public domain. Released as-is without guarantee of any kind. | ||
| + | * @stats [[File:Krinkle_SpecialAbuseLog_HistLink.js]] | ||
| + | * @source https://meta.wikimedia.org/wiki/User:Krinkle/Scripts/SpecialAbuseLog_HistLink | ||
| + | * | ||
| + | * Adds an additional (hist) link for article link on Special:AbuseLog | ||
| + | * Is appended after the link in $5 of [[MediaWiki:Abusefilter-log-detailedentry-meta]]. | ||
| + | * (due to $5 including the [[ and ]], fullurl: can't be used, hence this work-around | ||
| + | * | ||
| + | * Message: | ||
| + | * $1: $2 triggered $3, performing the action "$4" on $5. Actions taken: $6; Filter description: $7 ($8) | ||
| + | * Sample: | ||
| + | * <div class="mw-specialpage-summary"> <!-- (...) --> </div> | ||
| + | * <fieldset> | ||
| + | * <p>$1: <a href="/wiki/Special:Contributions/Foo">Foo</a> <span class="mw-usertoollinks">(<a>talk</a> | <a>block</a>)</span> triggered <a>filter 10</a>, performing the action "edit" on <a href="/wiki/Article" title="Article">Article</a>. Action taken: Warn; Filter description: Filternamehere (<a>details</a> | <a>examine</a>)</p> | ||
| + | * <!-- (...) --> | ||
| + | * </fieldset> | ||
| + | * | ||
| + | * The following script assumes that the *third* (0,1,2) anchor link that is a *direct child* of the paragraph tag. | ||
| + | */ | ||
| + | jQuery( function( $ ) { | ||
| + | |||
| + | var histLinkText = 'gesch', // [[MediaWiki:hist]] | ||
| + | linkOffset = 2; // 0 = first. By default the 3rd link is the article link (thus offset = 2) | ||
| + | |||
| + | if ( wgCanonicalSpecialPageName == 'AbuseLog' ) { | ||
| + | $( '.mw-specialpage-summary:first' ) | ||
| + | .next( 'fieldset' ) | ||
| + | .find( '> p:first > a' ) | ||
| + | .eq( linkOffset ) | ||
| + | .each( function() { | ||
| + | var $el = $(this), | ||
| + | $histLink = $( '<a>', { | ||
| + | title: $el.attr( 'title' ), | ||
| + | href: $el.attr( 'href' ) + '?action=history', | ||
| + | text: histLinkText | ||
| + | } ); | ||
| + | $el.after( ') ' ).after( $histLink ).after( ' (' ); | ||
| + | } ); | ||
| + | } | ||
| + | } ); | ||
/* cache key: wikikids_kn159:resourceloader:filter:minify-css:4:e1ed7d43a9731d396a701ad8e45fdaa0 */ | /* cache key: wikikids_kn159:resourceloader:filter:minify-css:4:e1ed7d43a9731d396a701ad8e45fdaa0 */ | ||
Versie van 2 aug 2013 12:15
/* JavaScript die hier wordt geplaatst heeft alleen invloed op gebruikers die de skin Vector gebruiken */
/**
* Titel_item
*
* Zoek Titel items op (class="Titel_item") (let op de hoofdletter)
* en plaats deze rechts van de titel
* Pas nadat overige titelbewerkingen hebben plaatsgevonden
* (te gebruiken voor bijv. {{Beveiligd}} en {{Semibeveiligd}} zodat deze onder de sluit-knop van de sitenotice komt
*/
function Titel_item() {
var h1 = document.getElementsByTagName("h1")[0];
var content = document.getElementById("content");
var icones = document.getElementsByTagName("div");
var icones2 = new Array();
var j = 0;
for (var i = 0; i < icones.length; ++i) {
if (icones[i].className == "Titel_item") {
icones2[j++] = icones[i];
}
}
for (; j > 0; --j) {
icones2[j-1].style.display = "block"; /* annule display:none par défaut */
icones2[j-1].style.borderWidth = "1px";
icones2[j-1].style.borderStyle = "solid";
icones2[j-1].style.borderColor = "white";
content.insertBefore(icones2[j-1], h1); /* déplacement de l'élément */
}
}
addOnloadHook(Titel_item);
/* Voor rechterbovenmargesjablonen */
/* Verbeterde versie, werkt beter dan Titel_item() */
function Titel_item3() {
var h1 = document.getElementsByTagName("h1")[0];
var content = document.getElementById("content");
var icones = document.getElementsByTagName("div");
var icones2 = new Array();
var j = 0;
for (var i = 0; i < icones.length; ++i) {
if (icones[i].className == "Titel_item2") {
icones2[j++] = icones[i];
}
}
for (; j > 0; --j) {
icones2[j-1].className = "Titel_item3";
if (icones2[j-1].id == "Titelbeveiligd" && wgUserName == null){
icones2[j-1].style.display = "none"; // titelwijzigingssjabloon alleen voor ingelogde gebruikers
}
content.insertBefore(icones2[j-1], h1); /* Verplaats het element naar de juiste plek */
}
Titel_toevoegen("templ_Semibeveiligd", h1, content);
Titel_toevoegen("templ_TitelBeveiligd", h1, content);
Titel_toevoegen("templ_Beveiligd", h1, content);
Titel_toevoegen("templ_Commons", h1, content); //staat rechtsboven, wordt geregeld in [[MediaWiki:Sharedupload]]
Titel_toevoegen("templ_Etalage", h1, content);
Titel_toevoegen("templ_Woordenboek", h1, content)
Titel_toevoegen("templ_Coordinaten", h1, content)
}
function Titel_toevoegen(de_div_id, h1, content) {
if (document.getElementById(de_div_id)){
document.getElementById(de_div_id).className = "Titel_item3";
content.insertBefore(document.getElementById(de_div_id), h1); /* Verplaats het element naar de juiste plek */
}
}
addOnloadHook(function(){ Titel_item3(); });
//div id's aangepast
/**
* Article history link for SpecialAbuseLog
* @author Krinkle
* @revision 4 (2010-01-28)
* @created January 27, 2011
* @license This script is released in the public domain. Released as-is without guarantee of any kind.
* @stats [[File:Krinkle_SpecialAbuseLog_HistLink.js]]
* @source https://meta.wikimedia.org/wiki/User:Krinkle/Scripts/SpecialAbuseLog_HistLink
*
* Adds an additional (hist) link for article link on Special:AbuseLog
* Is appended after the link in $5 of [[MediaWiki:Abusefilter-log-detailedentry-meta]].
* (due to $5 including the [[ and ]], fullurl: can't be used, hence this work-around
*
* Message:
* $1: $2 triggered $3, performing the action "$4" on $5. Actions taken: $6; Filter description: $7 ($8)
* Sample:
* <div class="mw-specialpage-summary"> <!-- (...) --> </div>
* <fieldset>
* <p>$1: <a href="/wiki/Special:Contributions/Foo">Foo</a> <span class="mw-usertoollinks">(<a>talk</a> | <a>block</a>)</span> triggered <a>filter 10</a>, performing the action "edit" on <a href="/wiki/Article" title="Article">Article</a>. Action taken: Warn; Filter description: Filternamehere (<a>details</a> | <a>examine</a>)</p>
* <!-- (...) -->
* </fieldset>
*
* The following script assumes that the *third* (0,1,2) anchor link that is a *direct child* of the paragraph tag.
*/
jQuery( function( $ ) {
var histLinkText = 'gesch', // [[MediaWiki:hist]]
linkOffset = 2; // 0 = first. By default the 3rd link is the article link (thus offset = 2)
if ( wgCanonicalSpecialPageName == 'AbuseLog' ) {
$( '.mw-specialpage-summary:first' )
.next( 'fieldset' )
.find( '> p:first > a' )
.eq( linkOffset )
.each( function() {
var $el = $(this),
$histLink = $( '<a>', {
title: $el.attr( 'title' ),
href: $el.attr( 'href' ) + '?action=history',
text: histLinkText
} );
$el.after( ') ' ).after( $histLink ).after( ' (' );
} );
}
} );
/* cache key: wikikids_kn159:resourceloader:filter:minify-css:4:e1ed7d43a9731d396a701ad8e45fdaa0 */