「MediaWiki:Common.js」の版間の差分
ナビゲーションに移動
検索に移動
| 72行目: | 72行目: | ||
if (!$(this).hasClass('collapse_end')) { | if (!$(this).hasClass('collapse_end')) { | ||
wrapped_elems.add($(this)); | wrapped_elems.add($(this)); | ||
| + | console.log(wrapped_elems); | ||
} else { | } else { | ||
| − | |||
return false; // break | return false; // break | ||
} | } | ||
2021年2月23日 (火) 22:35時点における版
/* ここにあるすべてのJavaScriptは、すべてのページ読み込みですべての利用者に対して読み込まれます */
$("a[target='_blank'][href^='https://twitter.com/'][href*='status']").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).closest('p').addClass('twitter_box');
$(element).remove();
}
});
if ($('body.page-ペルソナ5sコラボ表情集!').length > 0) {
$('p.twitter_box').first().before('<div id="halidom_wiki_tw_p_list" style="display: flex; flex-wrap: wrap;"></div>');
$('p.twitter_box').each(function(index, element) {
$(element).appendTo('#halidom_wiki_tw_p_list');
});
}
$.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");
}
function my_collapse_function(obj) {
var col_click_btn = this;
if (!$(col_click_btn).hasClass('col_invisible')) {
$(col_click_btn).removeClass('col_visible');
$(col_click_btn).addClass('col_invisible');
} else {
$(col_click_btn).removeClass('col_invisible');
$(col_click_btn).addClass('col_visible');
}
var col_start = $(col_click_btn).parents().nextAll('div.collapse_start');
if (col_start.length > 0 && col_start.first().nextAll('div.collapse_end').length > 0) {
if ($.trim(col_start.first().prev().text()) == '') {
col_start.first().prev().remove();
}
var wrapped_elems = $('notfoundelem');
col_start.nextAll().each(function(index,element){
if (!$(this).hasClass('collapse_end')) {
wrapped_elems.add($(this));
console.log(wrapped_elems);
} else {
return false; // break
}
});
}
}
$('.collapse_title').click(my_collapse_function);
$(document).ready(function(){
$('.collapse_title').click();
});