MediaWiki:Wikiminiatlas.js: Difference between revisions

stop showing the tooltip automatically after a few times
(Per request: https://meta.wikimedia.org/w/index.php?title=MediaWiki_talk:Wikiminiatlas.js&diff=4078170&oldid=4004208)
(stop showing the tooltip automatically after a few times)
Line 440: Line 440:
  // (experiment, only shown to anonymous users on en.wp if the browser supports localStorage)
  // (experiment, only shown to anonymous users on en.wp if the browser supports localStorage)
  if( wgUserName === null && wgDBname === 'enwiki' &&  
  if( wgUserName === null && wgDBname === 'enwiki' &&  
     window.localStorage &&
     window.localStorage ) {
    window.localStorage.getItem('wmatooltipdismissed') === null ) {
  (function() {
  var ttc = window.localStorage.getItem('wmatooltipdismissed') || 0;
  var wrap, span=$('#coordinates>span>span>img')
  if( ttc<5 && ttc!=='yes') {
    , bubble = $('<div><div>').css( { width: '150px', border: '1px solid #bbb', borderRadius: '8px', position: 'absolute', bottom: '22px', right: '-4px', whiteSpace: 'normal', textAlign: 'left', padding: '0.25em 0.75em 0.25em 0.75em', fontSize: '90%', backgroundColor: '#f9f9f9', boxShadow: '4px 4px 10px rgba(0,0,0,0.2)' } ).text('Click the blue globe to open an interactive map.').append( $('<div></div>').css({position: 'absolute', width: 0, height: 0, bottom: '-10px', right: '10px', borderBottom:0, borderLeft: '5px solid transparent', borderRight:  '5px solid transparent', borderTop:  '10px solid #bbb'})  ).append( $('<div></div>').css({position: 'absolute', width: 0, height: 0, bottom: '-7px', right: '10px', borderBottom:0, borderLeft: '5px solid transparent', borderRight:  '5px solid transparent', borderTop:  '10px solid #f9f9f9'})  ).hide();
  (function() {
    // increase display counter
    window.localStorage.setItem('wmatooltipdismissed',ttc+1);
    var wrap, span=$('#coordinates>span>span>img')
      , bubble = $('<div><div>').css( { width: '150px', border: '1px solid #bbb', borderRadius: '8px', position: 'absolute', bottom: '22px', right: '-4px', whiteSpace: 'normal', textAlign: 'left', padding: '0.25em 0.75em 0.25em 0.75em', fontSize: '90%', backgroundColor: '#f9f9f9', boxShadow: '4px 4px 10px rgba(0,0,0,0.2)' } ).text('Click the blue globe to open an interactive map.').append( $('<div></div>').css({position: 'absolute', width: 0, height: 0, bottom: '-10px', right: '10px', borderBottom:0, borderLeft: '5px solid transparent', borderRight:  '5px solid transparent', borderTop:  '10px solid #bbb'})  ).append( $('<div></div>').css({position: 'absolute', width: 0, height: 0, bottom: '-7px', right: '10px', borderBottom:0, borderLeft: '5px solid transparent', borderRight:  '5px solid transparent', borderTop:  '10px solid #f9f9f9'})  ).hide();
   if( span.length>0 ) {
   if( span.length>0 ) {
    wrap = $('<span></span>').css( { width: '20px', height: '17px', position: 'relative' } );
    wrap = $('<span></span>').css( { width: '20px', height: '17px', position: 'relative' } );
    span.wrap(wrap).parent().append(bubble.fadeIn().click(function(){ bubble.fadeOut(); window.localStorage.setItem('wmatooltipdismissed','yes') }));
    span.wrap(wrap).parent().append(bubble.fadeIn().click(function(){ bubble.fadeOut(); window.localStorage.setItem('wmatooltipdismissed','yes'); awt='c'; }));
    setTimeout( function() { bubble.fadeOut() }, 10*1000 );
    setTimeout( function() { bubble.fadeOut() }, 10*1000 );
    awt="1";
    awt="1";
   }
    }
   })();
   })();
   } else { awt=(ttc=='yes')?'p':ttc; }
  }
  }
  // detect and load KML
  // detect and load KML
  // also insert globe even if no title coords are given
  // also insert globe even if no title coords are given
Anonymous user