• 正在查找将来过去时的官方设定集?不如看看万界大百科吧!
  • 《将来过去时》第一部分 现在 魔科纪元的少年少女 即将正式发布!
  • 让我偷偷看一眼小鱼君的博客……
  • 服务器已成功迁移到 阿里云(杭州)

“MediaWiki:Common.js”的版本间的差异

来自小鱼君和他的朋友们
第104行: 第104行:
 
}(jQuery, mediaWiki));
 
}(jQuery, mediaWiki));
  
function PopupWindow(content) {
+
function PopupWindow(title,content) {
 +
  if (title != '' && content != '') {
 +
   title= '<h2 id="popup-window-title">' + title + '</h2>'
 +
  } else if (title != '' && title != undefined) {
 +
   content = title;
 +
   title= '';
 +
  } else if (title != '' && content != '') {
 +
   content = 'Error in Popup Window';
 +
   title = 'No content!';
 +
  }
 
   $('body').append(
 
   $('body').append(
 
   '<div id="popup-window-bg"></div>' +
 
   '<div id="popup-window-bg"></div>' +
 
   '<div id="popup-window">' +
 
   '<div id="popup-window">' +
   '<div id="popup-window-content">' +
+
  title +
  content +
+
   '<div id="popup-window-content">' + content +
 
   '</div><div id="poup-window-close">' +
 
   '</div><div id="poup-window-close">' +
   '<img />'+
+
   '<img id="btn"/>'+
 
   '</div></div>'
 
   '</div></div>'
 
);
 
);

2019年9月5日 (四) 23:28的版本

/** Site Scripts **/
(function ($, mw) {
//调用jQuery,顶级渲染

/** In page dialog **/
$(function () {
  var DialogId,
  BtnId,
  NextId,
  LastId;
  $('.ipd').html(function () {
    DialogId = this.dataset.dialogid;
    if (DialogId != '1') {
      $(this).hide();
    }
  });
  $('.ipd-next-btn').click(function () {
    BtnId = this.dataset.btnid;
    LastId = this.dataset.lastid;
    if (LastId === 'last') {
      $('#game-selector').show(300);
      $(this).css('color', 'green');
    } else {
      BtnId = parseInt(BtnId);
      NextId = ++BtnId;
      $(this).css('color', 'green');
      $('.ipd[data-dialogid=' + NextId + ']').show(300);
    }
  });
});

/** Game saver **/
$('.GameSaver').html(function(){
  var game,time,user,title,page;
  if ( wgUserName =='' || wgUserName == null ) {
    unlogin = true ;
  } else {
    user = 'User:'+wgUserName ;
}
  game = this.dataset.game;
  time = this.dataset.time;
  title = this.dataset.title;
  page = this.dataset.page;
  $(this).html('<input type=button class="save" value="保存游戏"/>&nbsp;&nbsp;<input type=button class="load" value="读取存档"/>');
  if ( unlogin ) {
    $('.GameSaver .load').click(function(){alert('无法读取存档,请登录后再试');});
  } else {
    $('.GameSaver .load').click(function(){location.href='/wiki/'+user+'/gamesave/'+game});
  }
  $('.GameSaver .save').click(function() {
    if ( unlogin ) {
      $('.GameSaver .save').unbind().attr({'value':'存档失败,请登录后再试','disabled':''});
      return;
    }
    var note = prompt('有什么要备注的吗?','无');
    if (note === null||note === 'null') {
      return;
    }
    $('.GameSaver .save').attr('value','SILI努力帮你存档中…');
    new mw.Api().post({
      action: 'edit',
      title: user+'/gamesave/'+game,
      summary: '\/*' + title+' | '+ time +'*\/新增游戏'+ game +'存档',
      appendtext: '\n== '+ title +' | '+ time +' ==\n*游戏:[[Game:'+ game +']]\n*时间:'+ time +'\n*[['+ page +'|继续游戏]]\n*备注:'+ note +'\n\n',
      token: mw.user.tokens.get('editToken')
    })
    .done(function(){
      $('.GameSaver .save').unbind().attr({'value':'存档完毕!','disabled':''});
    })
    .fail(function(){
      alert('啊哦,存档失败了!\n1)请检查您的网络连接?\n2)您是否没有登录?\n3)刷新页面再试?');
      $('.GameSaver .save').attr('value','重试');
    });
  });
});

/** 顶部公告 **/
/** 顶部公告 **/
function siteNoticeScroll(obj,interval) {
  $(obj).animate({
    height: 'show',
    paddingTop: 'show',
    marginTop: 'show',
    paddingBottom: 'show',
    marginBottom: 'show',
  });
  var isFrozen = false;
  setInterval(function() {
    $(obj).find('ul:first').animate({
      marginTop: '-25px'
    },
    300,
    function() {
      $(this).css({
        marginTop: '0px',
      }).find('li:first').appendTo(this);
    });
  },
  interval);
}
siteNoticeScroll('.siteNoticeScroll',5000);

//ALL CLEAR
}(jQuery, mediaWiki));

function PopupWindow(title,content) {
  if (title != '' && content != '') {
    title= '<h2 id="popup-window-title">' + title + '</h2>'
  } else if (title != '' && title != undefined) {
    content = title;
    title= '';
  } else if (title != '' && content != '') {
    content = 'Error in Popup Window';
    title = 'No content!';
  }
  $('body').append(
  '<div id="popup-window-bg"></div>' +
  '<div id="popup-window">' +
  title +
  '<div id="popup-window-content">' + content +
  '</div><div id="poup-window-close">' +
  '<img id="btn"/>'+
  '</div></div>'
);
  $('#poup-window-close, #poup-window-close-bg').fadeIn(300);
  $('#poup-window-close, #poup-window-close-bg').click(function(){
    $('#poup-window, #poup-window-close-bg').fadeOut(400);
    setTimeout(function(){$('#poup-window, #poup-window-close-bg').remove()},400);
  });
}