User:BZPN/Przeglądarka.js: Difference between revisions

From Test Wiki
Content deleted Content added
BZPN (talk | contribs)
No edit summary
Tag: Reverted
BZPN (talk | contribs)
No edit summary
Tag: Reverted
Line 1: Line 1:
// Autor: BZPN
// UŻYWASZ SKRYPTU NA WŁASNĄ ODPOWIEDZIALNOŚĆ! Autor nie ponosi odpowiedzialności za ew. szkody spowodowane użyciem skryptu.
$(document).ready(function () {
$(document).ready(function () {
var pageName = mw.config.get('wgCanonicalSpecialPageName');
if (mw.config.get('wgCanonicalSpecialPageName') !== 'Contributions') {
return;
}


// Sprawdź, czy gadżet popups jest włączony
if (pageName !== 'Contributions') {
if (!mw.user.options.get('popup')) {
return;
return;
}
}
Line 14: Line 19:
<span class="oo-ui-iconElement-icon oo-ui-iconElement-noIcon"></span>
<span class="oo-ui-iconElement-icon oo-ui-iconElement-noIcon"></span>
<span class="oo-ui-labelElement-label">Przeglądanie edycji</span>
<span class="oo-ui-labelElement-label">Przeglądanie edycji</span>
<span class="oo-ui-widget oo-ui-widget-enabled oo-ui-iconElement-icon oo-ui-icon-expand oo-ui-iconElement oo-ui-labelElement-invisible oo-ui-iconWidget">Expand</span>
<span class="oo-ui-widget oo-ui-widget-enabled oo-ui-iconElement-icon oo-ui-icon-expand oo-ui-iconElement oo-ui-labelElement-invisible oo-ui-iconWidget">Rozwiń</span>
<span class="oo-ui-widget oo-ui-widget-enabled oo-ui-iconElement-icon oo-ui-icon-collapse oo-ui-iconElement-invisible oo-ui-iconWidget">Collapse</span>
<span class="oo-ui-widget oo-ui-widget-enabled oo-ui-iconElement-icon oo-ui-icon-collapse oo-ui-iconElement oo-ui-labelElement-invisible oo-ui-iconWidget">Zwiń</span>
</legend>
</legend>
<div class="oo-ui-fieldsetLayout-group mw-collapsible-content" style="display: block;">
<div class="oo-ui-fieldsetLayout-group mw-collapsible-content" style="display: block;">
Line 21: Line 26:
<button id="review-selected-button" class="oo-ui-inputWidget-input oo-ui-buttonElement-button oo-ui-buttonElement-framed oo-ui-flaggedElement-progressive" style="padding: 5px 10px; background-color: #007bff; color: #fff; border: none; cursor: pointer; border-radius: 4px;">Przejrzyj zaznaczone edycje</button>
<button id="review-selected-button" class="oo-ui-inputWidget-input oo-ui-buttonElement-button oo-ui-buttonElement-framed oo-ui-flaggedElement-progressive" style="padding: 5px 10px; background-color: #007bff; color: #fff; border: none; cursor: pointer; border-radius: 4px;">Przejrzyj zaznaczone edycje</button>
<button id="review-all-button" class="oo-ui-inputWidget-input oo-ui-buttonElement-button oo-ui-buttonElement-framed oo-ui-flaggedElement-destructive" style="padding: 5px 10px; background-color: #ff4136; color: #fff; border: none; cursor: pointer; border-radius: 4px;">Przejrzyj wszystkie edycje</button>
<button id="review-all-button" class="oo-ui-inputWidget-input oo-ui-buttonElement-button oo-ui-buttonElement-framed oo-ui-flaggedElement-destructive" style="padding: 5px 10px; background-color: #ff4136; color: #fff; border: none; cursor: pointer; border-radius: 4px;">Przejrzyj wszystkie edycje</button>
<button id="show-diffs-button" class="oo-ui-inputWidget-input oo-ui-buttonElement-button oo-ui-buttonElement-framed" style="padding: 5px 10px; background-color: #17a2b8; color: #fff; border: none; cursor: pointer; border-radius: 4px;">Pokaż różnice</button>
<button id="cancel-review" class="oo-ui-inputWidget-input oo-ui-buttonElement-button oo-ui-buttonElement-framed" style="padding: 5px 10px; background-color: #aaa; color: #fff; border: none; cursor: pointer; border-radius: 4px;">Anuluj</button>
<button id="cancel-review" class="oo-ui-inputWidget-input oo-ui-buttonElement-button oo-ui-buttonElement-framed" style="padding: 5px 10px; background-color: #aaa; color: #fff; border: none; cursor: pointer; border-radius: 4px;">Anuluj</button>
</div>
</div>
Line 100: Line 106:
console.error('Błąd przy pobieraniu wkładu użytkownika:', error);
console.error('Błąd przy pobieraniu wkładu użytkownika:', error);
alert('Błąd przy pobieraniu wkładu użytkownika.');
alert('Błąd przy pobieraniu wkładu użytkownika.');
});
});

$('#show-diffs-button').click(function () {
$('input[type="checkbox"].review-checkbox:checked').each(function () {
var revid = $(this).data('revid');
var title = $(this).data('title');
mw.popups.open(mw.util.getUrl('index.php?title=' + encodeURIComponent(title) + '&diff=' + revid), {
width: 800,
height: 600
});
});
});
});
});
Line 107: Line 124:
});
});


// Dodanie checkboxów i przycisku wywołującego popup
$('li[data-mw-revid]').each(function () {
$('li[data-mw-revid]').each(function () {
var $this = $(this);
var $this = $(this);
Line 118: Line 134:


$this.prepend($checkbox);
$this.prepend($checkbox);

// Dodaj przycisk podglądu edycji
var $previewButton = $('<button class="preview-edit-button" style="margin-left: 10px;">Podgląd</button>');
$this.append($previewButton);

$previewButton.click(function () {
if (typeof popupShowPreview === 'function') {
popupShowPreview($this.find('.mw-contributions-title a')[0], ''); // Wywołaj popup
} else {
console.error('Gadżet Navigation Popups nie jest załadowany.');
}
});
});
});
}
}