משתמש:GilCahana/vector.js
מראה
הערה: לאחר הפרסום, ייתכן שיהיה צורך לנקות את זיכרון המטמון (cache) של הדפדפן כדי להבחין בשינויים.
- פיירפוקס / ספארי: להחזיק את המקש Shift בעת לחיצה על טעינה מחדש (Reload) או ללחוץ על צירוף המקשים Ctrl-F5 או Ctrl-R (במחשב מק: ⌘-R).
- גוגל כרום: ללחוץ על צירוף המקשים Ctrl-Shift-R (במחשב מק: ⌘-Shift-R).
- אדג': להחזיק את המקש Ctrl בעת לחיצה על רענן (Refresh) או ללחוץ על צירוף המקשים Ctrl-F5.
importScript('משתמש:קובי כרמל/SlideShow.js');
importUserScript(64);
importUserScript(16);
/* צובע עריכות אנונימיים בשינויים אחרונים. From Yonidebest */
function highlightAnon() {
if (wgCanonicalSpecialPageName != 'Recentchanges') return;
var ipRx = /(([0-1]?[0-9]{1,2}\.)|(2[0-4][0-9]\.)|(25[0-5]\.)){3}(([0-1]?[0-9]{1,2})|(2[0-4][0-9])|(25[0-5]))/;
var liElements = document.getElementsByTagName('UL')[0].getElementsByTagName('LI');
for (var i = 0; i < liElements.length; i++) {
var ipRxIndex = (liElements[i].getElementsByTagName('A')[0].innerHTML == 'הבדל') ? 3 : 2;
var m = ipRx.exec(liElements[i].getElementsByTagName('A')[ipRxIndex].title);
if (m)
liElements[i].getElementsByTagName('A')[ipRxIndex].style.backgroundColor = '#FFECB2';
}
}
$(highlightAnon);
$(function(){
if (skin == "vector") {
var head = document.getElementById('head');
if(head) removeKeys(head.getElementsByTagName('a'));
var panel = document.getElementById('panel');
if(panel) removeKeys(panel.getElementsByTagName('a'));
} else {
var columnOne = document.getElementById('column-one');
if (!columnOne) columnOne = document.getElementById('mw_portlets');
if (!columnOne) return;
removeKeys(columnOne.getElementsByTagName('a'));
var cactions = document.getElementById('p-cactions');
if(cactions) removeKeys(cactions.getElementsByTagName('a'));
var personal = document.getElementById('p-personal');
if(personal) removeKeys(personal.getElementsByTagName('a'));
}
removeKeys(document.getElementsByTagName('input'));
removeKeys(document.getElementsByTagName('label'));
})
function removeKeys(nodeList){
var el;
for (var i = 0; i < nodeList.length; i++) {
el = nodeList[i];
if (!el.accessKey) continue;
if (window.tooltipAccessKeyRegexp && !window.removeAccessKeys || removeAccessKeys.indexOf(el.accessKey) >= 0) {
el.accessKey = ''; //el.setAttribute('accessKey', '');
if (el.title) el.title = el.title.replace(window.tooltipAccessKeyRegexp, '');
}
}
}
$('.mw-editsection-divider').next('a').text('עריכה');
$('#ca-edit a, .mw-editsection a:last').text('עריכה');
/* קואורדינטות של ערן */
function reviewArticle() {
var coord = $( this ).text(),
article = $( this ).parents( 'tr' ).find( 'td:first a' ).prop( 'title' ),
DEFAULT_SUMMARY = 'הוספה חצי אוטומטית של קואורדינטות',
SUBMIT_TEXT = 'אישור',
SUBMIT_NOTIF = 'בקשה נשלחה לשרת',
SUBMIT_SUCCESS = 'הבקשה בוצעה';
api = new mw.Api();
mw.loader.using(['jquery.ui'], function(){
var api=new mw.Api();
api.get({
action:'parse',
page: article,
prop: 'text'
}).done(function(data){
function postCoords(){
mw.notify(SUBMIT_NOTIF);
api.postWithToken( 'edit',
{
action: 'edit',
title: article,
appendtext: '\n' +coord,
summary: DEFAULT_SUMMARY
}).done(function(){
mw.notify(SUBMIT_SUCCESS);
$dialog.dialog('close').remove();
});
}
var $submit = $('<div>').text(SUBMIT_TEXT).button().click(postCoords);
var $dialog = $('<div>' +data.parse.text['*']+'</div>').prepend(t$submit).dialog( {
width:'60%',
height: '600'
})
})
});
}
$('.coord_suggestion').wrap($('<a href="#">').click(reviewArticle))