Utilizator:Pixi/monobook.js
De la Wikipedia, enciclopedia liberă
Notă: După salvare, trebuie să treceţi peste cache-ul browser-ului pentru a vedea modificările.
- Mozilla, Safari, Konqueror: ţineţi apăsat Shift în timp ce apăsaţi butonul Reload (sau apăsaţi Ctrl-Shift-R).
- IE: apăsaţi Ctrl-F5.
- Opera: apăsaţi F5.
//++butoane //<pre> //============================================================ // en: ADD SOME EXTRA BUTTONS TO THE EDITPANEL // de: FÜGE NEUE BUTTON IN DIE WERKZEUGLEISTE //============================================================ // Vorschläge für neue Buttons werden gerne entgegengenommen // Die Reihenfolge und Anzahl der Buttons ist über die (alphabetische) Variable XEBOrder wählbar. if (typeof XEBOrder == 'undefined') // can be modified XEBOrder="A,B,D,C,D1,F,U,S,I1,I2,J1,E,G,Q,W,X,K,L,M,H,O,R,T,V"; if (XEBOrder.toLowerCase() == 'all') XEBOrder="A,B,D,C,D1,F,U,S,I1,I2,J1,E,G,Q,W,X,K,L,M,H,O,R,T,V,FS,J2,N,P,P1,R1,R2,R3,R4,T1,TL,Y1,Y2,Z,AI"; //fills the variable mwCustomEditButtons (s. function in /wikibits.js), with buttons for the Toolbar function addCustomButton(imageFile, speedTip, tagOpen, tagClose, sampleText){ mwCustomEditButtons.push({ "imageFile": imageFile, "speedTip": speedTip, "tagOpen": tagOpen, "tagClose": tagClose, "sampleText": sampleText}); } var Isrc='http://upload.wikimedia.org/wikipedia/commons/'; var BDict={ 'A0':['6/6f/Bold_icon.png','Bold text','\'\'\'','\'\'\'','Bold text'], 'B0':['d/d7/Italic_icon.png','Italic text','\'\'','\'\'','Italic text'], 'C0':['f/f3/Internal_link_icon.png','Internal link','[[',']]','Link title'], 'D0':['7/73/External_link_icon.png','External link (remember http:// prefix)','[',']','http://www.example.com link title'], 'E0':['b/ba/Headline_icon.png','Level 2 headline','\n== ',' ==\n','Headline text'], 'F0':['f/f0/Image_icon.png','Embedded image','[[Image:',']]','Example.jpg'], 'G0':['9/9d/Media_icon.png','Media file link','[[Media:',']]','Example.ogg'], 'H0':['5/5b/Math_icon.png','Mathematical formula (LaTeX)','<math>','<\/math>','Insert formula here'], 'I0':['8/82/Nowiki_icon.png','Ignore wiki formatting','<nowiki>','<\/nowiki>','Insert non-formatted text here'], 'J0':['c/c7/Signature_icon.png','Your signature with timestamp','--~~~~'], 'K0':['a/a4/H-line_icon.png','Horizontal line (use sparingly)','\n----\n'], 'A':['e/e9/Button_headline2.png','Secondary headline','\n===','===','Secondary headline'], 'B':['1/13/Button_enter.png','Line break','<br />','',''], 'C':['5/5f/Button_center.png','Center','<div style="text-align: center;">\n','\n<\/div>','Centred text'], 'D':['e/ea/Button_align_left.png','Left-Align','<div style="text-align: left; direction: ltr; margin-left: 1em;">\n','\n<\/div>','Left-aligned text'], 'D1':['a/a5/Button_align_right.png','Right-Align','<div style="text-align: right; direction: ltr; margin-left: 1em;">\n','\n<\/div>','Right-aligned text'], 'E':['0/04/Button_array.png','Table','\n{| class="wikitable" \n|- \n| 1 || 2\n|- \n| 3 || 4','\n|}\n',''], 'F':['1/1e/Button_font_color.png','Insert coloured text','<span style="color: ','">Coloured text<\/span>','ColourName'], 'FS':['1/1b/Button_miss_signature.png','Unsigned post','{{subst:unsigned|','|date}}','user name or IP'], 'G':['9/9e/Btn_toolbar_gallery.png','Picture gallery',"\n<gallery>\nImage:","|[[M63]]\nImage:Mona Lisa.jpg|[[Mona Lisa]]\nImage:Truite arc-en-ciel.jpg|Eine [[Forelle ]]\n<\/gallery>",'M63.jpg'], 'H':['7/74/Button_comment.png','Comment',"<!--","-->",'Comment'], 'I1':['6/6a/Button_sup_letter.png','Superscript','<sup>','<\/sup>','Superscript text'], 'I2':['a/aa/Button_sub_letter.png','Subscript','<sub>','<\/sub>','Subscript text'], 'J1':['5/58/Button_small.png','Small','<small>','<\/small>','Small Text'], 'J2':['5/56/Button_big.png','Big text','<big>','<\/big>','Big text'], 'K':['b/b4/Button_category03.png','Category',"[[Category:","]]",'Category name'], 'L':['8/8e/Button_shifting.png','Insert tab(s)',':','',':'], 'M':['f/fd/Button_blockquote.png','Insert block of quoted text','<blockquote style="border: 1px solid blue; padding: 2em;">\n','\n<\/blockquote>','Block quote'], 'N':['4/4b/Button_nbsp.png','nonbreaking space',' ','',''], 'O':['2/23/Button_code.png','Insert code','<code>','<\/code>','Code'], 'P':['3/3c/Button_pre.png','Pre formatted Text','<pre>','<\/pre>','Pre formatted text'], 'P1':['9/93/Button_sub_link.png','Insert link to sub-page','[[','/Sub_Page]]','Page'], 'Q':['d/d3/Button_definition_list.png','Insert definition list','\n; ','\n: Item 1\n: Item 2','Definition'], 'R':['7/79/Button_reflink.png','Insert a reference','<ref>','<\/ref>','Insert reference material'], 'R1':['7/79/Button_reflink.png','Start a reference','<ref name="','','Reference name'], 'R2':['9/99/Button_reflink_advanced_2.png','Insert reference material','">','</ref>','Reference material'], 'R3':['1/1a/Button_reflink_advanced_3.png','No reference material','','"/>',''], 'R4':['9/9a/Button_references.png','Reference footer',"\n==Notes==\n<!--See http://en.wikipedia.org/wiki/Wikipedia:Footnotes for an explanation of how to generate footnotes using the <ref(erences/)> tags-->\n<div class=\'references-small\'>\n<references/>\n</div>",'',''], 'S':['c/c9/Button_strike.png','Strikeout','<s>','<\/s>','Struck out text'], 'T':['e/eb/Button_plantilla.png','Template','{{','}}','Template name'], 'T1':['3/30/Tt_icon.png','Teletype text','<tt>','<\/tt>','Teletype Text'], 'TL':['3/37/Button_tl_template.png','Template link',"{{subst:"+"tl|",'}}','Template name'], 'U':['f/fd/Button_underline.png','Underlined',"<u>","<\/u>",'Underlined text'], 'V':['c/c8/Button_redirect.png','Redirect',"#REDIRECT [[","]]",'Article Name'], 'W':['8/88/Btn_toolbar_enum.png','Numbering',"\n# ","\n# Element 2\n# Element 3",'Element 1'], 'X':['1/11/Btn_toolbar_liste.png','List',"\n* ","\n* Element B\n* Element C",'Element A'], 'Y1':['c/ce/Button_no_include.png','No Include',"<noinclude>","<\/noinclude>",'Text'], 'Y2':['7/79/Button_include.png','Include only',"<includeonly>","<\/includeonly>",'Text'], 'Z':['3/35/Button_substitute.png','Substitute',"{{subst:","}}",'Template'], 'AI':['1/1c/Button_advanced_image.png','Advanaced Image',"[[Image:","|thumb|right|px|Caption]]",'FileName.jpg'] } XEBOrder=XEBOrder.split(","); for (var b in XEBOrder) { var bc = BDict[XEBOrder[b]]; addCustomButton(Isrc+bc[0],bc[1],bc[2],bc[3],bc[4]) } //</pre> // [[:en:User:Lupin/popups.js]] document.write('<script type="text/javascript" src="' + 'http://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); //<pre><nowiki> //-------------------------------------------------------------- //First loads //Helper tools document.write('<script type="text/javascript" src="' + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/Addtabs/monobook.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); ////////////////////// //Admin rollback tools document.write('<script type="text/javascript" src="' + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/Specialadmin/monobook.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); //END //BCrat tools document.write('<script type="text/javascript" src="' + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/Bureaucrat/monobook.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); RfAshowlinks = 'true'; //END //CU tools document.write('<script type="text/javascript" src="' + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/CheckUser/monobook.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); //END //UTC clock document.write('<script type="text/javascript" src="' + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/UTCclock.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); //END //Admin protection tools document.write('<script type="text/javascript" src="' + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/Protection/monobook.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); //END //Approvals document.write('<script type="text/javascript" src="' + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/Approvals.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); //END //Replace txt document.write('<script type="text/javascript" src="' + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/replacetxt.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); //END</nowiki></pre> //<nowiki><pre> //--------------------------------------------------------------- //Toolbox links function changelinks() { if(!document.getElementById) return; var toplinks = document.getElementById('p-personal').getElementsByTagName('ul')[0]; var user_name = document.getElementById('pt-userpage').getElementsByTagName('a')[0].innerHTML; if (document.title.indexOf('User:' + user_name + '/xml') != -1 || document.title.indexOf('User:' + user_name + '/XML') != -1) {addlilink(toplinks, 'javascript:XMLrequestprompt()', 'Request XML', 'Request XML');} document.getElementById('pt-mytalk').firstChild.innerHTML = 'Pg discuţii'; document.getElementById('pt-preferences').firstChild.innerHTML = 'Preferinţe'; document.getElementById('pt-watchlist').firstChild.innerHTML = 'Pg urmărite'; document.getElementById('pt-mycontris').firstChild.innerHTML = 'Contribuţii'; document.getElementById('pt-logout').firstChild.innerHTML = 'Log out'; if(document.getElementById('ca-delete')) {document.getElementById('ca-delete').firstChild.innerHTML = '<strong><span style="color:darkred;">delete</span></strong>';} } function navigationlinks() { addnavbox_link('/wiki/Wikipedia:Cereri pentru protejarea paginilor','Cereri protejare','rfpp-ln'); addnavbox_link('/wiki/Categorie:Articole_de_şters','De şters','speedy-ln'); addnavbox_link('/wiki/Wikipedia:Administrators%27_noticeboard','Noticeboard','AN-ln'); addnavbox_link('/wiki/Wikipedia:Administrator_intervention_against_vandalism','Vandalism','aiv-ln'); } function addtoolboxlinks() { var tb = document.getElementById('p-tb').getElementsByTagName('ul')[0]; addlilink(tb, '/wiki/Special%3ALog&type=block&user=&page=', 'Pagini blocate', ''); addlilink(tb, '/wiki/Special:Newpages', 'Pagini noi', ''); addlilink(tb, '/wiki/Special:Log/protect', 'Pagini protejate', ''); addlilink(tb, '/w/Special%3ALog&type=delete&user=&page=', 'Pagini şterse', ''); addlilink(tb, '/wiki/Special:Log/newusers', 'Utilizatori noi', ''); } //END //--------------------------------------------------------------- // ======== USER TABS ======= function userlogs() { //no subpages or history if (document.title.search("/") != -1 || location.href.search(/Special:|&action=[^p]|&diff=/) !=-1) {return;} if (document.title.indexOf("User:") == 0 || document.title.indexOf("User talk:") == 0) { username = wgTitle.replace(/User:|User talk:/,''); addTab("/w/index.php?title=Special%3ALog&type=block&user=" + username, "log", "ca-log", "actions", ""); addTab("/w/index.php?title=Special%3ALog&type=block&user=&page=User:" + username, "bl", "ca-blog", "block log", ""); addTab("http://tools.wikimedia.de/~interiot/cgi-bin/count_edits?dbname=enwiki_p&user=" + username, "edits", "ca-kate", "user info", ""); } } //************ //************ //LAST DIFF TAB function lastdiff() { if (document.title.indexOf("Editing ") != -1 || document.getElementById('ca-history') == undefined || location.href.search(/&action=history/) !=-1){return;} addTab("/w/index.php?title=" + wgPageName.replace(/&/g,'%26') + "&diff=cur&oldid=prev", "Last", "ca-diff", "Show most recent diff", ""); } // This will add an [edit top] link at the top of all pages except preview pages function addtoplink() { var edittop = '<span style="color:black;">[</span>edit top<span style="color:black;">]</span>'; // if this is preview page or generated page, stop if(location.href.search(/title=Special:|\/Special:/) != -1) return; if(document.title.indexOf("Main Page") != -1) return; // create div and set innerHTML to link var divContainer = document.createElement("div"); divContainer.innerHTML = '<div class="editsection" style="float:right;margin-left:5px;margin-right:130px;margin-top:3px;"><a href="/w/index.php?title=' + wgPageName + '&action=edit§ion=0" title="' + wgTitle + '">' + edittop + '</a></div>'; // insert divContainer into the DOM before the h1 if (document.getElementById("content") !=undefined) { document.getElementById("content").insertBefore(divContainer, document.getElementsByTagName("h1")[0]);} } //END //************ //MAIN //************ addOnloadHook(Mainfast) function Mainfast() { userlogs(); changelinks(); navigationlinks(); addtoolboxlinks(); } window.onload = Main; function Main() { watchlist_tab(); block_check(); lastdiff(); addtoplink(); } //END //************ function watchlist_tab() { if (location.href.indexOf('Special:Watchlist/edit') !=-1) {addTab("javascript:watchlist_clean()", "check deleted pages", "ca-clean", "check all deleted pages", "");} } function watchlist_clean() { //monobook if (document.getElementById('bodyContent')) { var body = document.getElementById('bodyContent'); } //cologneblue else if (document.getElementById('quickbar')) { if (!document.getElementById('content')){return;} var body = document.getElementById('content'); } var l = body.getElementsByTagName('li'); for (var i=0; i<l.length; i++) { if (l[i].getElementsByTagName('a')[0].href.indexOf('&action=') !=-1) {l[i].getElementsByTagName('input')[0].checked=true;} } } function block_check() { if (document.title.indexOf('Block user') !=0){return;} //monobook if (document.getElementById('pt-userpage')) {var user_name = document.getElementById('pt-userpage').getElementsByTagName('a')[0].innerHTML;} //cologneblue else if (document.getElementById('quickbar') && document.getElementById('quickbar').getElementsByTagName('h6')[0]) { var toplinks = document.getElementById('quickbar'); var user_name = toplinks.innerHTML.split('<h6>My pages</h6>')[1].split('title="User:')[1].split('"')[0]; } if (document.getElementsByTagName('input')[0].value == user_name) {alert('Are you sure you want to block yourself?');} else if (document.getElementsByTagName('input')[0].value == user_name.replace(/ /g,'_')) {alert('Are you sure you want to block yourself?');} } // addOnloadHook(Dfn_js_con) function Dfn_js_con() { Mvaluejs_class = 'DMalak1'; Rvaluejs_class = 'ERollen2'; Uvaluejs_class = 'DRaven2'; } // //************ //New user log tools document.write('<script type="text/javascript" src="' + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/Sleeper/monobook.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); //END //Admin warning tools document.write('<script type="text/javascript" src="' + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/Adminwarnings/monobook.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); //END //Delete tabs document.write('<script type="text/javascript" src="' + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/Deletion/monobook.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); //END //************ //Google tools document.write('<script type="text/javascript" src="' + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/Google/monobook.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); //END //Interiot's javascript edit counter if (document.title.indexOf('User:Interiot/Tool2/code.js') != -1) { document.write('<script type="text/javascript" src="' + 'http://en.wikipedia.org/w/index.php?title=User:Interiot/Tool2/code.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); } // //************ //Lupin's tools //************ //Filter changes live [[Category:VoA scripted admins]] //[[User:Lupin/recent2.js]] - please include this line document.write('<script type="text/javascript" src="' + 'http://en.wikipedia.org/w/index.php?title=User:Lupin/recent2.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); //[[User:Lupin/popupsdev.js]] - please include this line document.write('<script type="text/javascript" src="' + 'http://en.wikipedia.org/w/index.php?title=User:Lupin/popupsdev.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); popupShortcutKeys=true; // optional: enable keyboard shortcuts popupAdminLinks=true; // optional: enable admin links [[Category:VoA scripted admins]] popupSubpopups=false; popupOnEditSelection=false; popupStructure='shortmenus'; //END //************ function XMLrequestprompt() { var parameters = ''; var type = 'GET'; var url = location.href; url = prompt('Enter a URL:'); parse_js_value_cache = 0; parse_js_value_cache = prompt('Parse the data?' + '\n' + '0 - false (default)' + '\n' + '1 - true (no script/SRCs/images)' + '\n' + '2 - true (no script/SRCs)' + '\n' + '3 - true (script/images allowed)'); if (parse_js_value_cache != 0 && parse_js_value_cache != 1 && parse_js_value_cache != 2 && parse_js_value_cache != 3){return;} if (!url || url == ''){return;} makeRequestXML(url, parameters,type); } function alertContents() { if (http_request.readyState != 4) return; body = document.getElementById('bodyContent'); if (body && parse_js_value_cache == 3) { document.getElementsByTagName('title')[0].innerHTML = "XML request:"; body.innerHTML = '<strong>XML source return:</strong><br>' + http_request.responseText; } else if (body && parse_js_value_cache == 2) { document.getElementsByTagName('title')[0].innerHTML = "XML request:"; var xml = http_request.responseText.replace(/<.script>/gi,'`</script>'); body.innerHTML = '<strong>XML source return:</strong><br>' + xml.replace(/<script [^`]+`<.script>/gi,'').replace(/(<\w* onload=["'][^<]+["']>)/gi,'').replace(/(\src=["'][^<]+["']>)/gi,' src="">'); } else if (body && parse_js_value_cache == 1) { document.getElementsByTagName('title')[0].innerHTML = "XML request:"; var xml = http_request.responseText.replace(/<.script>/gi,'`</script>'); body.innerHTML = '<strong>XML source return:</strong><br>' + xml.replace(/<script [^`]+`<.script>/gi,'').replace(/(<\w* onload=["'][^<]+["']>)/gi,'').replace(/(<img [^<]+>)/gi,'').replace(/(\src=["'][^<]+["']>)/gi,' src="">'); } else if (body && parse_js_value_cache == 0) { document.getElementsByTagName('title')[0].innerHTML = "XML request:"; var xml = http_request.responseText.replace(/<.script>/gi,'`</script>'); xml = xml.replace(/(<a href=["'][^<]+<.a>)/gi,'%parenST|span style="background-color: yellow"|%parenEN$1%parenST|/span|%parenEN').replace(/(<img [^<]+>)/gi,'%parenST|span style="background-color: lightgreen"|%parenEN$1%parenST|/span|%parenEN').replace(/(<iframe [^<]+<.iframe>)/gi,'%parenST|span style="background-color: lightgreen"|%parenEN$1%parenST|/span|%parenEN').replace(/(<script [^`]+)`<.script>/gi,'%parenST|span style="background-color: #FF9900"|%parenEN$1</script>%parenST|/span|%parenEN').replace(/(<\w* onload=["'][^<]+["']>)/gi,'%parenST|span style="background-color: #FF9900"|%parenEN$1%parenST|/span|%parenEN').replace(/\s(src=["'][^<]+["'])>/gi,'%parenST|span style="background-color: #FF3300"|%parenEN $1>%parenST|/span|%parenEN'); body.innerHTML = '<strong>XML source return:</strong><br>' + xml.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/%parenST\|/g,'<').replace(/\|%parenEN/g,'>'); } } //security override HTTP request //ALSO, reduce IE security settings //For FF/NS, go enable, see "http://esw.w3.org/topic/SparqlCalendarDemoUsage#FAQ" //Basically, enable "signed.applets.codebase_principal_support" in about:config function makeRequestXML(url, parameters,type,parse) { if(window.XMLHttpRequest) { try {netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead"); } catch (e) {alert("Permission UniversalBrowserRead denied."); } http_request = false; http_request = new XMLHttpRequest(); if (http_request.overrideMimeType) {http_request.overrideMimeType('text/xml'); } if (!http_request) {alert('Cannot create XMLHTTP instance'); return false; } http_request.onreadystatechange = alertContents; http_request.open(type, url + parameters, true); http_request.send(null); } else if (window.ActiveXObject) { try {http_request = new ActiveXObject("Msxml2.XMLHTTP");} catch (e) { try {http_request = new ActiveXObject("Microsoft.XMLHTTP");} catch (e){} } if (!http_request) {showError(ERROR_XML);} http_request.onreadystatechange = alertContents; http_request.open(type, url + parameters, true); http_request.send(null); } } // //</nowiki></pre>[[Category:VoA scripted admins]]