「MediaWiki:Common.js」の版間の差分

提供: 聖城wiki2.0
ナビゲーションに移動 検索に移動
1行目: 1行目:
 
 
/* ここにあるすべてのJavaScriptは、すべてのページ読み込みですべての利用者に対して読み込まれます */
 
/* ここにあるすべてのJavaScriptは、すべてのページ読み込みですべての利用者に対して読み込まれます */
  
$("a[target='_blank'][href^='https://twitter.com/']").each(function(index, element){
+
$("a[target='_blank'][href^='https://twitter.com/']").each(function(index,
 +
  element) {
 
   console.log(index + ':' + $(element).text());
 
   console.log(index + ':' + $(element).text());
 
   if ($(element).parent('blockquote.twitter-tweet').length == 0) {
 
   if ($(element).parent('blockquote.twitter-tweet').length == 0) {
 
     var href_tw_url = $(element).attr('href');
 
     var href_tw_url = $(element).attr('href');
     var html_tw_data = '<blockquote class="twitter-tweet" data-width="240" data-height="360"><a target="_blank" rel="nofollow noreferrer noopener" class="external free" href="' + href_tw_url + '">' + href_tw_url + '</a></blockquote>';
+
     var html_tw_data =
 +
      '<blockquote class="twitter-tweet" data-width="240" data-height="360"><a target="_blank" rel="nofollow noreferrer noopener" class="external free" href="' +
 +
      href_tw_url + '">' + href_tw_url + '</a></blockquote>';
 
     $(element).parent().append(html_tw_data);
 
     $(element).parent().append(html_tw_data);
     $(element).closest('p').css('float','left');
+
     $(element).closest('p').css('float', 'left');
     $(element).closest('p').css('margin-right','20px');
+
     $(element).closest('p').css('margin-right', '20px');
 
     $(element).remove();
 
     $(element).remove();
 
   }
 
   }
 
});
 
});
 
$.getScript("//platform.twitter.com/widgets.js");
 
$.getScript("//platform.twitter.com/widgets.js");
 
  
  
 
$.getScript("//ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js");
 
$.getScript("//ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js");
$('body').prepend('<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.css">');
+
$('body').prepend(
 +
  '<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.css">'
 +
);
  
 
function halidom_wiki2_newpage_dialog() {
 
function halidom_wiki2_newpage_dialog() {
   $('<div >新しく作る/編集するページの名前<input type="text" id="halidom_wiki2_newpage_input"></div>').dialog({modal:true,buttons:{"移動":function(){window.location.href="/index.php?veaction=edit&title=" + $("#halidom_wiki2_newpage_input").val();}}});
+
   $(
 +
    '<div >新しく作るページの名前<input type="text" id="halidom_wiki2_newpage_input"></div>'
 +
  ).dialog({
 +
    modal: true,
 +
    buttons: {
 +
      "移動": function() {
 +
        window.location.href = "/index.php?veaction=edit&title=" + $(
 +
          "#halidom_wiki2_newpage_input").val();
 +
      }
 +
    }
 +
  });
 
}
 
}
  
 
$('#n-randompage').after(
 
$('#n-randompage').after(
'<li></li><li id="newpage_link_button_added"><a href="#" title="新しいページを作ります" onclick="halidom_wiki2_newpage_dialog()">ページを追加</a></li>');
+
  '<li></li><li id="newpage_link_button_added"><a href="#" title="新しいページを作ります" onclick="halidom_wiki2_newpage_dialog()">ページを追加</a></li>'
 +
);
  
  
 
function createPracticePage() {
 
function createPracticePage() {
open("/index.php?veaction=edit&preload=シャノン&title=練習用ページ_" + new Date().getTime().toString(16) + Math.floor(1000*Math.random()).toString(16), "_blank");
+
  open("/index.php?veaction=edit&preload=シャノン&title=練習用ページ_" + new Date().getTime()
 +
    .toString(16) + Math.floor(1000 * Math.random()).toString(16), "_blank");
 
}
 
}

2021年2月2日 (火) 08:42時点における版

/* ここにあるすべてのJavaScriptは、すべてのページ読み込みですべての利用者に対して読み込まれます */

$("a[target='_blank'][href^='https://twitter.com/']").each(function(index,
  element) {
  console.log(index + ':' + $(element).text());
  if ($(element).parent('blockquote.twitter-tweet').length == 0) {
    var href_tw_url = $(element).attr('href');
    var html_tw_data =
      '<blockquote class="twitter-tweet" data-width="240" data-height="360"><a target="_blank" rel="nofollow noreferrer noopener" class="external free" href="' +
      href_tw_url + '">' + href_tw_url + '</a></blockquote>';
    $(element).parent().append(html_tw_data);
    $(element).closest('p').css('float', 'left');
    $(element).closest('p').css('margin-right', '20px');
    $(element).remove();
  }
});
$.getScript("//platform.twitter.com/widgets.js");


$.getScript("//ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js");
$('body').prepend(
  '<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.css">'
);

function halidom_wiki2_newpage_dialog() {
  $(
    '<div >新しく作るページの名前<input type="text" id="halidom_wiki2_newpage_input"></div>'
  ).dialog({
    modal: true,
    buttons: {
      "移動": function() {
        window.location.href = "/index.php?veaction=edit&title=" + $(
          "#halidom_wiki2_newpage_input").val();
      }
    }
  });
}

$('#n-randompage').after(
  '<li></li><li id="newpage_link_button_added"><a href="#" title="新しいページを作ります" onclick="halidom_wiki2_newpage_dialog()">ページを追加</a></li>'
);


function createPracticePage() {
  open("/index.php?veaction=edit&preload=シャノン&title=練習用ページ_" + new Date().getTime()
    .toString(16) + Math.floor(1000 * Math.random()).toString(16), "_blank");
}