ব্যবহারকারী:Yahya/URLdecoder.js
লক্ষ্য করুন: প্রকাশ করার পর, পরিবর্তনগুলো দেখতে আপনাকে আপনার ব্রাউজারের ক্যাশে পরিষ্কার করার প্রয়োজন হতে পারে।
- ফায়ারফক্স / সাফারি: পুনরায় লোড-এ ক্লিক করার সময় শিফট টিপে ধরে রাখুন, অথবা হয় Ctrl-F5 বা Ctrl-R টিপুন (ম্যাকে ⌘-R টিপুন)
- গুগল ক্রোম: Ctrl-Shift-R (ম্যাকে ⌘-Shift-R) টিপুন
- এজ: Ctrl ধরে রাখা অবস্থায় Refresh-এ ক্লিক করুন, অথবা Ctrl-F5 টিপুন।
- অপেরা: Ctrl-F5 টিপুন।
// Decodes long UTF-encoded URLs and displays a copyable link in an OOUI pop-up
// @match https://*.wikipedia.org/*
// <nowiki>
(function() {
'use strict';
// Add a link to the portlet
mw.util.addPortletLink(
'p-personal',
'#',
'Decode URL',
't-decode-url',
'Decode the current URL'
);
// Decode UTF-encoded URL parts
function decodeURL(url) {
try {
return decodeURIComponent(url);
} catch (e) {
console.error('Error decoding URL:', e);
return url;
}
}
// Create an OOUI dialog
function showDecodedURL(decodedURL) {
var dialog = new OO.ui.MessageDialog();
var windowManager = new OO.ui.WindowManager();
$(document.body).append(windowManager.$element);
windowManager.addWindows([dialog]);
// Create a copyable input field
var copyableInput = new OO.ui.TextInputWidget({
value: decodedURL,
readOnly: true
});
// Create a copy button
var copyButton = new OO.ui.ButtonWidget({
label: 'Copy',
icon: 'copy',
flags: ['primary', 'progressive']
});
copyButton.on('click', function() {
copyableInput.$input[0].select();
document.execCommand('copy');
});
// Show the dialog with the input field and copy button
windowManager.openWindow(dialog, {
title: 'Decoded URL',
message: copyableInput.$element.add(copyButton.$element)
});
}
// Event handler for the Decode URL link
$('#t-decode-url').on('click', function(e) {
e.preventDefault();
var currentURL = window.location.href;
var decodedURL = decodeURL(currentURL);
showDecodedURL(decodedURL);
});
})();
// </nowiki>