Khác biệt giữa bản sửa đổi của “MediaWiki:Gadget-Twinkle.js”

Nội dung được xóa Nội dung được thêm vào
cập nhật nhãn xóa
Không có tóm lược sửa đổi
Dòng 216:
* Special layout of p-cactions and p-personal through specialized styles.
* Vector:
* "mw-panel"For each option, the outer div class contains "portalvector-menu", the inner div class "body". Existing portlets/elements:is "pvector-logo", "pmenu-navigationcontent", "p-interaction",and the ul is "pvector-tb", "pmenu-collcontent-print_exportlist"
* "leftmw-navigationpanel", outer div class contains "vectorTabsvector-menu-portal". orExisting portlets/elements: "vectorMenup-logo", inner div class "p-navigation" or, "menup-interaction". Existing portlets:, "p-namespacestb", "p-variantscoll-print_export" (menu)
* "rightleft-navigation", outer div class "vectorTabs" or "vectorMenu", inner div classcontains "vector-menu-tabs" or "vector-menu-dropdown". Existing portlets: "p-viewsnamespaces", "p-cactionsvariants" (menu), "p-search"
* "right-navigation", outer div class contains "vector-menu-tabs" or "vector-menu-dropdown". Existing portlets: "p-views", "p-cactions" (menu), "p-search"
* Special layout of p-personal portlet (part of "head") through specialized styles.
* Modern:
Hàng 232 ⟶ 233:
* @return Node -- the DOM node of the new item (a DIV element) or null
*/
Twinkle.addPortlet = function( navigation, id, text, type, nextnodeid) ){
// sanity checks, and get required DOM nodes
{
var root = document.getElementById( navigation) || document.querySelector(navigation);
//sanity checks, and get required DOM nodes
if ( !root ) {
var root = document.getElementById( navigation );
if ( !root ) {
return null;
}
 
var item = document.getElementById( id );
if ( item ) {
if ( item.parentNode && item.parentNode === root ) {
return item;
}
Dòng 249:
 
var nextnode;
if ( nextnodeid ) {
nextnode = document.getElementById(nextnodeid);
}
 
// verify/normalize input
var skin = mw.config.get("'skin"');
type =if ( skin =!== "'vector"' && type === "menu" &&|| ( navigation =!== "'left-navigation"' ||&& navigation =!== "'right-navigation" ')) ? "menu" : "";{
type = null; // menu supported only in vector's #left-navigation & #right-navigation
var outerDivClass;
{}
var innerDivClass;
var outerDivClass, innerDivClass;
switch ( skin) ){
{
case "'vector"':
// XXX: portal doesn't work
if ( navigation !== "'portal"' && navigation !== "'left-navigation"' && navigation !== "'right-navigation" ') {
navigation = "'mw-panel"';
}
outerDivClass = ('vector-menu vector-menu-' + (navigation === "'mw-panel" )' ? "'portal"' : ( type === "'menu"' ? "vectorMenu"'dropdown' : "vectorTabs" 'tabs');
innerDivClass = ( navigation === "mw'vector-panel" ) ? "body" : ( type === "menu" ? "menu" : "" )-content';
break;
case "'modern"':
if ( navigation !== "'mw_portlets"' && navigation !== "'mw_contentwrapper" ') {
navigation = "'mw_portlets"';
}
outerDivClass = "'portlet"';
break;
innerDivClass = "pBody";
case 'timeless':
outerDivClass = 'mw-portlet';
innerDivClass = "pBody"'mw-portlet-body';
break;
default:
navigation = "'column-one"';
outerDivClass = "'portlet"';
innerDivClass = "pBody";
break;
}
 
// Build the DOM elements.
var outerDiv = document.createElement( "div" 'nav');
outerDiv.setAttribute('aria-labelledby', id + '-label');
outerDiv.className = outerDivClass + " emptyPortlet";
// Vector getting vector-menu-empty FIXME TODO
outerDiv.className = outerDivClass + "' emptyPortlet"';
outerDiv.id = id;
if ( nextnode && nextnode.parentNode === root ) {
root.insertBefore( outerDiv, nextnode );
} else {
root.appendChild( outerDiv );
}
 
var h5h3 = document.createElement( "'h3" ');
h3.id = id + '-label';
if ( type === "menu" ) {
var spanul = document.createElement( "span" 'ul');
span.appendChild( document.createTextNode( text ) );
h5.appendChild( span );
 
if ( typeskin === "menu" 'vector') {
var a = document.createElement( "a" );
// add invisible checkbox to keep menu open when clicked
a.href = "#";
// similar to the p-cactions ("More") menu
if (outerDivClass.indexOf('vector-menu-dropdown') !== -1) {
var chkbox = document.createElement('input');
chkbox.className = 'vectorMenuCheckbox vector-menu-checkbox'; // remove vectorMenuCheckbox after 1.35-wmf.37 goes live
chkbox.setAttribute('type', 'checkbox');
chkbox.setAttribute('aria-labelledby', id + '-label');
outerDiv.appendChild( h5 chkbox);
 
var span = document.createElement('span');
$( a ).click(function ( e ) {
span.appendChild( document.createTextNode( text ) );
e.preventDefault();
h5 h3.appendChild( span );
 
var a = document.createElement( "'a" ');
if ( !Twinkle.userAuthorized ) {
a.href = "'#"';
alert("Xin lỗi, tài khoản của bạn quá mới để sử dụng Twinkle.");
}
});
 
$( a ).click(function ( e ) {
h5.appendChild( a );
e.preventDefault();
});
 
h5 h3.appendChild( a );
}
 
(innerDiv || outerDiv).appendChild( ul h3);
ul.className = 'menu vector-menu-content-list'; // remove menu after 1.35-wmf.37 goes live
} else {
h5h3.appendChild( document.createTextNode( text ) );
outerDiv.appendChild(h3);
}
outerDiv.appendChild( h5 );
 
varif (innerDivClass;) {
var innerDiv = null;
var innerDiv = document.createElement( "'div" ');
if ( type === "menu" ) {
innerDiv = document.createElement( "div" );
innerDiv.className = innerDivClass;
innerDiv.appendChild(ul);
outerDiv.appendChild(innerDiv);
} else {
outerDiv.appendChild(ul);
}
 
var ul = document.createElement( "ul" );
(innerDiv || outerDiv).appendChild( ul );
 
return outerDiv;
 
};