ব্যবহারকারী:Mahir256/wikidatalist.js
টীকা: সংরক্ষণ করার পর, পরিবর্তনসমূহ তৎক্ষণাৎ নাও দেখাতে পারে। আপনার ব্রাউজারের ক্যাশ কিভাবে এড়াবেন তা জানতে এখানে ক্লিক করুন।
- ফায়ারফক্স / সাফারি: Shift ধরে রাখা অবস্থায়পুনঃলোড করুন-এ ক্লিক করুন, অথবা Ctrl-F5 বা Ctrl-R (ম্যাক-এ ⌘-R) চাপুন
- গুগল ক্রোম: Ctrl-Shift-R (ম্যাক-এ ⌘-Shift-R) চাপুন
- ইন্টারনেট এক্সপ্লোরার: Ctrl ধরে রাখা অবস্থায় Refresh-এ ক্লিক করুন, অথবা Ctrl-F5 চাপুন
- অপেরা: মেনু → ব্যবস্থাপনাসমূহ-এ যান (ম্যাকে অপেরা → পছন্দসমূহ) এবং এরপর গোপনীয়তা ও সুরক্ষা → ব্রাউজিং-এর তথ্য পরিষ্কার করুন → ক্যাশে করা ছবি ও ফাইলগুলি।
অন্যান্য ব্রাউজার সম্পর্কে বিশদ নির্দেশাবলীর জন্য, উইকিপিডিয়া:আপনার ক্যাশে বাইপাস করুন দেখুন।
mw.loader.using( 'oojs-ui' ).done( function () {
$( function () {
importStylesheet('ব্যবহারকারী:Mahir256/annotator.css');
function makeSPARQLQuery( endpointUrl, sparqlQuery, doneCallback ) {
var settings = {
headers: { Accept: 'application/sparql-results+json' },
data: { query: sparqlQuery }
};
return $.ajax( endpointUrl, settings ).then( doneCallback );
}
function runSparqlQuery(sparqlQuery, callback){
var endpointUrl = 'https://query.wikidata.org/sparql';
makeSPARQLQuery( endpointUrl, sparqlQuery, callback);
}
function MyProcessDialog( config ) {
MyProcessDialog.super.call( this, config );
}
OO.inheritClass( MyProcessDialog, OO.ui.ProcessDialog );
MyProcessDialog.static.name = 'myProcessDialog';
MyProcessDialog.static.title = 'উইকিউপাত্ত তালিকা';
MyProcessDialog.static.actions = [
{ label: 'কোয়েরি চালু করুন', action: 'runQuery', flags: 'primary' },
{ label: 'বাতিল করুন', flags: 'safe' }
];
var myWikidataApi = new mw.Api({'ajax':{'url': 'https://www.wikidata.org/w/api.php', 'timeout': 30000, 'dataType': 'json'}});
var myWikisourceApi = new mw.Api();
MyProcessDialog.prototype.initialize = function () {
MyProcessDialog.super.prototype.initialize.apply( this, arguments );
var currentDialog = this;
this.content = new OO.ui.PanelLayout( { padded: true, expanded: false } );
this.templateSelectorData = {
'publisher': {
'query': 'SELECT ?item {\n?item wdt:P123 wd:Q1; # এখানে প্রকাশক আইডি থাকবে\n wdt:P407 wd:Q9610; wdt:P1957 []\n}',
'templatePrefix': '{{#invoke:উইকিউপাত্ত তালিকা|PublisherPage|'
},
'anniversary': {
'query': 'SELECT DISTINCT ?item ?p ?pLabel (year(?tv) as ?year) {\n?sitelink schema:about ?item ; schema:isPartOf <https://bn.wikisource.org/>.\n{ ?item p:P569 [ psv:P569 [ wikibase:timeValue ?tv ; wikibase:timePrecision "11"^^xsd:integer ] ] . bind(wd:P569 as ?p)}\nUNION\n{ ?item p:P570 [ psv:P570 [ wikibase:timeValue ?tv ; wikibase:timePrecision "11"^^xsd:integer ] ] . bind(wd:P570 as ?p)}\nfilter(month(?tv) = 5 && day(?tv) = 24)\nSERVICE wikibase:label { bd:serviceParam wikibase:language "bn". }\n}\nORDER BY ?tv\nLIMIT 10',
'templatePrefix': '{{#invoke:উইকিউপাত্ত তালিকা|AnniversaryPage|'
}
};
this.templateSelector = new OO.ui.DropdownInputWidget( {
options: [
{
data: '0',
label: 'তালিকা টেমপ্লেট নির্বাচন করুন',
disabled: true
},
{
data: 'publisher',
label: 'প্রকাশক সংস্করণ তালিকা'
},
{
data: 'anniversary',
label: 'উইকিসংকলন বার্ষিকী'
}],
value: '0'
} );
this.textInput = new OO.ui.MultilineTextInputWidget( {
rows: 10,
autosize: true,
value: '# এখানে আপনার কোয়েরিটা লিখুন\n# আপনার কোয়েরিতে "?item" মানটা থাকা উচিত'
} )
$(this.textInput.$element).css('height', '240px');
this.templateSelector.onMenuSelect = function(value){
var valueData = currentDialog.templateSelectorData[value.getData()];
currentDialog.textInput.setValue(valueData['query']);
};
this.content.$element.append(
this.templateSelector.$element,
this.textInput.$element,
);
$(this.textInput.$element).addClass('annotator-results');
this.$body.append( this.content.$element );
};
MyProcessDialog.prototype.getActionProcess = function ( action ) {
var dialog = this;
if ( action == 'runQuery' ) {
let templateChoice = dialog.templateSelectorData[dialog.templateSelector.getValue()];
let templatePrefix = templateChoice['templatePrefix'];
runSparqlQuery(dialog.textInput.getValue(), function( data ) {
let outputItemList = '';
for(j = 0; j < data['results']['bindings'].length; j++){
var itemLink = data['results']['bindings'][j]['item']['value'];
outputItemList = outputItemList + ',' + itemLink.replace('http://www.wikidata.org/entity/', '');
}
document.getElementById("wpTextbox1").value = templatePrefix + outputItemList.slice(1) + '}}';
dialog.executeAction('');
});
}
return MyProcessDialog.super.prototype.getActionProcess.call( this, action );
};
MyProcessDialog.prototype.getBodyHeight = function () {
return 300;
};
var node2 = new OO.ui.ButtonWidget( {
icon: 'edit',
label: 'Edit',
invisibleLabel: true,
classes: ['annotator-cornerlink']
} );
node2.on( 'click', function ( e ) {
var windowManager = new OO.ui.WindowManager();
$( document.body ).append( windowManager.$element );
var dialog = new MyProcessDialog();
windowManager.addWindows( [ dialog ] );
windowManager.openWindow( dialog );
} );
$( 'body' ).append( node2.$element );
} );
} );