Usunięta treść Dodana treść
Linia 484:
{
var _g = /_/g;
this.fullname = mw.config.get('wgPageName').replace(_g, ' ');
this.id = mw.config.get('wgNamespaceNumber');
if(this.id !== 0){
Linia 495:
this.namespace="";
}
var subpagename_re=/\/[^\/]*$/gre,i,_bookname;
var i = this.pagename.search(subpagename_re);
this.subpagename = this.pagename.slice(i + 1);
var re;
if(this.id === 0 || this.id === 104) {
re=/^[^\/]*/g;
this.bookbookname = this.pagename.match(re);
this.book=this.bookname;
re=/^[^\/]*\//g;
this.articlename=this.pagename.replace(re,'');
Linia 507 ⟶ 505:
if(this.id == 4){
re=/^Brudnopis\/[^\/]*\/[^\/]*/g;
this.bookbookname = this.pagename.match(re);
if(this.bookbookname === null){
this.bookbookname=this.pagename;
this.book=this.bookname;
re=/^[^\/]*\//g;
this.articlename=this.pagename.replace(re,'');
}else{
re=/\/[^\/]*$/g;
_bookname=this.bookname.toString();
i=_bookname.search(re);
this.book=_bookname.slice(i+1);
re=/^Brudnopis\/[^\/]*\/[^\/]*\//g;
this.articlename=this.pagename.replace(re,'');
Linia 521 ⟶ 524:
if(! this.pagename.match(re)){
re=/^[^\/]*\/[^\/]*/g;
this.bookbookname = this.pagename.match(re);
if(this.bookbookname === null){
this.bookbookname=this.pagename;
this.book=this.bookname;
re=/^[^\/]*\//g;
this.articlename=this.pagename.replace(re,'');
}else{
re=/\/[^\/]*$/g;
_bookname=this.bookname.toString();
i=_bookname.search(re);
this.book=_bookname.slice(i+1);
re=/^[^\/]*\/[^\/]*\//g;
this.articlename=this.pagename.replace(re,'');
}
}else{
re=/^[^\/]*/g;
this.bookbookname = this.pagename.match(re);
this.book=this.bookname;
re=/^[^\/]*\//g;
this.articlename=this.pagename.replace(re,'');
Linia 539 ⟶ 547:
}else{
re=/^[^\/]*/g;
this.bookbookname = this.pagename.match(re);
this.book=this.bookname;
re=/^[^\/]*\//g;
this.articlename=this.pagename.replace(re,'');
Linia 545 ⟶ 554:
}
}
var subpagename_re=/\/[^\/]*$/g;
this.fullbook = (this.id===0)?this.book:this.namespace+":"+this.book;
var i = this.pagename.search(subpagename_re);
this.subpagename = (i!=-1)?this.pagename.slice(i + 1):this.bookname;
this.fullbookfullbookname = (this.id===0)?this.bookbookname:this.namespace+":"+this.bookbookname;
if ( document.URL.search("//pl.wikibooks.org/w/index.php") != -1 ) {
re = /\&diff=/g;
Linia 566 ⟶ 578:
function insertGoogleSearch() {
var id = pageInfo.id;
var fullbookfullbookname = pageInfo.fullbookfullbookname;
var bookbookname=pageInfo.bookbookname;
var diff_brudnopis=/^Brudnopis\/[^\/]*\/[^\/]*$/g;
var diff_user=/^[^\/]*\/[^\/]*$/g;
var wikijunior_mainpage="Strona główna";
if (((id !== 0) && (id != 104) && ( id != 4) && (id != 2))
|| ((id == 104) && (bookbookname == wikijunior_mainpage))
|| ((id == 4) && (! diff_brudnopis.test(bookbookname)))
|| ((id == 2) && (! diff_user.test(bookbookname)))
|| googleSearchInitialized
) {
Linia 590 ⟶ 602:
 
var google;
if ( fullbookfullbookname.length == 1 || fullbookfullbookname.indexOf('++') != -1 || encodeURIComponent(fullbookfullbookname) != fullbookfullbookname ) {
google = "http://www.google.com/custom?sa=Google+Search&domains=pl.wikibooks.org/wiki/&sitesearch=pl.wikibooks.org/wiki/&q=%22PAGE%22";
}else{
Linia 596 ⟶ 608:
}
 
link.href = google.replace(/PAGE/g, encodeURIComponent(fullbookfullbookname));
link.appendChild(document.createTextNode("Szukaj w podręczniku"));
 
Linia 607 ⟶ 619:
}
$(insertGoogleSearch);
 
</syntaxhighlight>
Ten kod również znajduje się na stronie {{LinkUżytkownik2|Persino/common.js}}, czy mógłbyś zastąpić pewne fragmenty kodu w {{LinkKomunikat2|common.js}} przez ten kod. Należy wymienić pewne fragmenty kodu na to! Ten kod wyświetla link ''Szukaj w podręczniku'' w lewej nawigacji obok stron podręczników w przestrzeni mnazw {{Np|(main)|link=tak}} i {{Np|Wikijunior|link=tak}} oraz w nibyprzestrzeniach: Wikibooks:Brudnopis/<nazwa użytkownika>, np.: {{LinkProjekt2|Brudnopis/Persino}} i Wikipedysta:<Użytkownik>, np.: {{LinkUżytkownik2|Persino}}. W tych przestrzeniach i nibyprzestrzeniach mogą lub znajdują się książki. [[Wikipedysta:Persino|Persino]] ([[Dyskusja wikipedysty:Persino|dyskusja]]) 18:38, 11 lip 2020 (CEST)