Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2018
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $( function() {
  2.         var timeout = 10*1000; //*1000;
  3.         if ( location.search.match(/(?:\?|&)(ve)?action=(edit|submit)/ ) ) {
  4.                 mw.loader.load( ['mediawiki.notify', 'mediawiki.api'] );
  5.                 var notifyFunc = function() {
  6.                 var $msg = $( '<div>Your session is about to expire</div><br>' )
  7.                         .append( $( '<br><a href="#">Renew session</a>' )
  8.                         .click( function(e) {
  9.                                 var api = new mw.Api;api.get( { action: 'query' } );
  10.                                 e.preventDefault();
  11.                                 window.setTimeout( notifyFunc, timeout);
  12.                                 } )
  13.                         );
  14.                         mw.notify( $msg, { 'autohide': false } );
  15.                 }
  16.                 window.setTimeout( notifyFunc, timeout );
  17.         }
  18. } );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement