Pengguna:Py21/common.js
Tampilan
Catatan: Setelah menyimpan, Anda harus memintas tembolok (cache) peramban Anda untuk melihat perubahannya. Google Chrome, Firefox, Microsoft Edge dan Safari: Tahan tombol ⇧ Shift dan klik Muat ulang (Reload) di tombol bilah alat. Untuk detail dan instruksi tentang peramban lain, lihat halaman menghapus singgahan (Inggris).
/**Variabel-variabel yang dipakai secara global */
var LoadInterProject = true;
var LoadLinkFA = true;
var LoadNavFrame = true;
var load_edittools = true;
var LoadExtraPortlet = true;
var LoadStripe = true;
var LoadEditTop = true;
var LoadExtraEditButtons = true;
var load_extratabs = false;
var LoadPageCounter = false;
/* Sunting bagian 0 **************
*/
function addEdittopPortletLink() {
if(mw.config.get('wgCanonicalNamespace') == 'Special') return;
if(document.getElementById("wikiPreview")) return;
if(document.getElementById("histlegend")) return;
if(document.getElementById("difference")) return;
if(document.getElementById("watchdetails")) return;
if ( document.getElementById( "ca-edit" ) ) {
var sElm = document.getElementById( "ca-addsection" ) ? 'ca-addsection' : 'ca-edit';
var sText = (skin=='vector')?'Sunting bagian atas':'▲';
var sLink = mw.config.get('wgScriptPath') + "/index.php?title=" + mw.config.get('wgPageName') + "&action=edit§ion=0";
mw.util.addPortletLink( 'p-cactions', sLink, sText, 'ca-edittop', 'Suntingan bagian atas halaman ini', null, document.getElementById( sElm ).nextSibling );
}
}
$( addEdittopPortletLink );
/* Geser pranala "Sunting bagian: " mendekat ke samping judul bagian
* [[User:Drilnoth/lefteditlinks.js]]
*/
// font-size css definition for edit link span
if (typeof(leftEditLinkFontSize) == 'undefined') { var leftEditLinkFontSize = 'small'; }
// css definition for spacing after heading text span
if (typeof(leftEditLinkSpacing) == 'undefined') { var leftEditLinkSpacing = '0.2em'; }
// main program
var LeftEditLinkMain = function() {
// recursively fix all spans inside headings
var content = document.getElementById('mw_content');
if(!content) return;
var LeftEditLink = function(level) {
// get all heading of this level
var headings = content.getElementsByTagName('h' + level);
for (var i = 0; i < headings.length; i ++) {
var heading = headings[i];
// get edit span
var editSpan = heading.firstChild;
if (editSpan == null) { continue }
if (editSpan.className != 'editsection') { continue }
// get blank
var blank = editSpan.nextSibling;
if (blank == null) { continue }
if (blank.nodeValue != ' ') { continue }
// get heading span
var headingSpan = blank.nextSibling;
if (headingSpan == null) { continue }
if (headingSpan.nodeName != 'SPAN') { continue }
// move blank after heading text
heading.appendChild(blank);
// move edit span after blank
heading.appendChild(editSpan);
// get rid of evil edit span floating
editSpan.style.styleFloat = 'none';
editSpan.style.cssFloat = 'none';
// set edit span font size
editSpan.style.fontSize = leftEditLinkFontSize;
// set heading span right margin
headingSpan.style.marginRight = leftEditLinkSpacing;
}
// recurse through heading levels
if (level < 6) {
LeftEditLink(level + 1);
}
return;
};
// call recursive function
LeftEditLink(1);
};
$(LeftEditLinkMain);