「MediaWiki:Common.js」の版間の差分
ナビゲーションに移動
検索に移動
Hiratatomotaka (トーク | 投稿記録) 編集の要約なし |
Hiratatomotaka (トーク | 投稿記録) 編集の要約なし |
||
7行目: | 7行目: | ||
console.log("nebula_switch: 入れ替え後のページです"); | console.log("nebula_switch: 入れ替え後のページです"); | ||
var | var view_tab = document.getElementById("ca-view"); | ||
if ( | if (view_tab) | ||
var is_view_mode = | var is_view_mode = view_tab.classList.contains("selected"); | ||
else | else | ||
var is_view_mode = false; | var is_view_mode = false; | ||
16行目: | 16行目: | ||
if (is_view_mode && is_not_ve_edit_mode){ | if (is_view_mode && is_not_ve_edit_mode){ | ||
console.log("nebula_switch: 閲覧モードです"); | console.log("nebula_switch: 閲覧モードです"); | ||
var switch_tag = document.getElementById("nebula_switch"); | |||
if (switch_tag){ | |||
var parser = new Parser(switch_tag); // 未定義 | |||
if (parser.is_failed) | |||
write_error("入れ替えタグが異常です。" + parser.failure_message); | |||
// 未定義 | |||
} | |||
else | |||
console.log( | |||
"nebula_switch: 入れ替えタグが見つかりませんでした" | |||
); | |||
}else | }else | ||
console.log( | console.log( | ||
"nebula_switch: 閲覧モードでないため、入れ替えは行いません" | "nebula_switch: 閲覧モードでないため、入れ替えは行いません" | ||
); | |||
} | } | ||
} | } | ||
my_switch(); | my_switch(); |
2024年5月1日 (水) 20:38時点における版
/* ここにあるすべてのJavaScriptは、すべてのページ読み込みですべての利用者に対して読み込まれます */ function my_switch(){ var uri = new URL(window.location.href); var is_switched = uri.searchParams.get("nebula_switch") != null; if (is_switched){ console.log("nebula_switch: 入れ替え後のページです"); var view_tab = document.getElementById("ca-view"); if (view_tab) var is_view_mode = view_tab.classList.contains("selected"); else var is_view_mode = false; var is_not_ve_edit_mode = uri.searchParams.get("veaction") == null; if (is_view_mode && is_not_ve_edit_mode){ console.log("nebula_switch: 閲覧モードです"); var switch_tag = document.getElementById("nebula_switch"); if (switch_tag){ var parser = new Parser(switch_tag); // 未定義 if (parser.is_failed) write_error("入れ替えタグが異常です。" + parser.failure_message); // 未定義 } else console.log( "nebula_switch: 入れ替えタグが見つかりませんでした" ); }else console.log( "nebula_switch: 閲覧モードでないため、入れ替えは行いません" ); } } my_switch();