Cookies help us deliver our services. By using our services, you agree to our use of cookies. More information

Difference between revisions of "MediaWiki:Common.js"

From NoSQLZoo
Jump to: navigation, search
Line 1: Line 1:
/* Any JavaScript here will be loaded for all users on every page load. */
+
$(function(){
 +
  //Allow all the tables to be collapsible
 +
  //items move into the "More" actions
 +
  //Change the following to change the word "More"
 +
  //http://sqlzoo.net/dev/MediaWiki:Vector-more-actions
 +
  $('#left-navigation,#right-navigation').hide();
 +
  $('#ca-view,#ca-viewsource,#ca-edit').addClass('collapsible');
 +
 +
  $('#mw-head').append(
 +
    $('<div/>',{id:'cog-cont'}).append(
 +
      $('<div/>',{
 +
        css:{'background-image':'url(/design/Cog_font_awesome.svg)',
 +
            'z-index':1003,
 +
            width:32,height:32,position:'absolute',right:0,top:0},
 +
        title:'Wiki Controls',
 +
        id:'cog',
 +
        click:function(){
 +
          $('#coglist').slideToggle();
 +
          if ($('#overlay').length==0){
 +
            $('<div/>',{id:'overlay',
 +
              click:function(){
 +
                $('#coglist').slideUp();
 +
                $('#overlay').remove();
 +
              },
 +
              css:{
 +
                position:'absolute',
 +
                top:0,left:0,background:'#aaaaaa',
 +
                width:'100%',height:'100%',
 +
                opacity:0.3,
 +
                'z-index':1002
 +
            }})
 +
              .appendTo('body');
 +
          }else{
 +
            $('#overlay').remove();
 +
          }
 +
        }
 +
      }))
 +
  );
 +
}

Revision as of 12:17, 28 July 2015

$(function(){
  //Allow all the tables to be collapsible
  //items move into the "More" actions
  //Change the following to change the word "More"
  //http://sqlzoo.net/dev/MediaWiki:Vector-more-actions
  $('#left-navigation,#right-navigation').hide();
  $('#ca-view,#ca-viewsource,#ca-edit').addClass('collapsible');
 
  $('#mw-head').append(
    $('<div/>',{id:'cog-cont'}).append(
      $('<div/>',{
        css:{'background-image':'url(/design/Cog_font_awesome.svg)',
             'z-index':1003,
             width:32,height:32,position:'absolute',right:0,top:0},
        title:'Wiki Controls',
        id:'cog',
        click:function(){
          $('#coglist').slideToggle();
          if ($('#overlay').length==0){
            $('<div/>',{id:'overlay',
              click:function(){
                $('#coglist').slideUp();
                $('#overlay').remove();
              },
              css:{
                position:'absolute',
                top:0,left:0,background:'#aaaaaa',
                width:'100%',height:'100%',
                opacity:0.3,
                'z-index':1002
            }})
              .appendTo('body');
          }else{
            $('#overlay').remove();
          }
        }
      }))
  );
}