Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
mw.loader.load('https://en.bharatpedia.org/w/index.php?title=MediaWiki:Gadget-OneClickArchiver.js&action=raw&ctype=text/javascript&maxage=0&smaxage=0&t=' + Date.now());
mw.loader.load( 'ext.gadget.BharatMitra' );
mw.loader.load( 'ext.gadget.UserStats' );
$(function(){mw.loader.using('mediawiki.api').then(function(){var api=new mw.Api();function ppost(p){var d=$.Deferred();api.postWithToken('csrf',p).then(function(data){d.resolve({ok:true,d:data});},function(c,data){d.resolve({ok:false,code:String(c),d:data});});return d.promise();}function pget(p){var d=$.Deferred();api.get(p).then(function(data){d.resolve({ok:true,d:data});},function(c,data){d.resolve({ok:false,code:String(c),d:data});});return d.promise();}function getText(t){var d=$.Deferred();pget({action:'query',prop:'revisions',titles:t,rvprop:'ids|content',rvslots:'main',formatversion:2}).then(function(r){if(!r.ok){d.resolve({ok:false,code:r.code});return;}var pg=(r.d.query&&r.d.query.pages)||[];var p0=pg[0]||{};var rev=p0.revisions&&p0.revisions[0];if(!rev){d.resolve({ok:false,code:'norev'});return;}var txt=(rev.slots&&rev.slots.main&&rev.slots.main.content)||rev.content||'';d.resolve({ok:true,text:txt,revid:rev.revid});});return d.promise();}var R={};ppost({action:'edit',title:'User:Bharatwiki Socrates/TrailingTest.js',text:'ABC\n',summary:'Trailing newline test 1',createonly:1}).then(function(r1){R.create1=r1.ok?r1.d.edit.newrevid:r1.code;return getText('User:Bharatwiki Socrates/TrailingTest.js');}).then(function(g1){R.read1Len=g1.ok?g1.text.length:null;R.read1Last=g1.ok&&g1.text.length?g1.text.charCodeAt(g1.text.length-1):-1;R.read1Revid=g1.ok?g1.revid:null;return ppost({action:'edit',title:'User:Bharatwiki Socrates/TrailingTest.js',text:'ABC\n\n',summary:'Trailing newline test 2',baserevid:g1.revid});}).then(function(r2){R.edit2=r2.ok?r2.d.edit.newrevid:r2.code;return getText('User:Bharatwiki Socrates/TrailingTest.js');}).then(function(g2){R.read2Len=g2.ok?g2.text.length:null;R.read2Last=g2.ok&&g2.text.length?g2.text.charCodeAt(g2.text.length-1):-1;var d=document.createElement('div');d.id='trail-test';d.textContent='TRAILTEST '+JSON.stringify(R);document.body.appendChild(d);});});});