User:GZWDer/Toolscript

Show page names in page list (excluded namespace)

edit
  • for (var page in <list>.pages ) {ts.log (<list>.pages[page].page_title); }

Empty the output log

edit
  • $(ts.output_selector).empty();

Remove claims

edit
//Use at your own risk!
//List should be page list to be worked on, which can be got by ts.wdq
//Change P70 to the correct property ID
function test (ids) {
  $.getJSON ( '//www.wikidata.org/w/api.php?callback=?' , {
                        action:'wbgetentities',
                        ids:ids,
                        format:'json',
                        props:'claims|info'
                } , function ( d ) {
                        var claims = ((((d.entities||{})[ids]||{}).claims||{})[prop]) ;
                        if ( typeof claims == 'undefined' ) {
                                return ;
                        }
                        var statement_id ;
                        $.each ( (claims||[]) , function ( k , v ) {
                                statement_id = v.id ;
                                return false ; // Got one
                        } ) ;
                        if ( typeof statement_id == 'undefined' ) {
                                return ;
                        }
                        ts.log("$.getJSON ( '//tools.wmflabs.org/widar/index.php?action=remove_claim&id="+statement_id+"&botmode=1');") ;
                        //$.getJSON ( '//tools.wmflabs.org/widar/index.php?action=remove_claim&id='+statement_id+'&botmode=1');
                } ) ;
}
prop ='P70';
for (var page in list.pages ) {
  ids =   list.pages[page].page_title ;
  
test(ids);
 
}