본문으로 이동
  • 이 서버는 리버티게임의 개발용 베타 서버로, 게임 플레이 용도로 제작된 사이트가 아닙니다.
  • 리버티게임의 자동 인증된 사용자라면 개발에 필요한 관리자 권한을 신청할 수 있습니다.
  • 틀 및 기능별 소도구를 필요한 문서에만 선택적으로 로딩하는 테스트를 진행하고 있습니다. 작동하지 않는 문서가 있다면 담당자에게 알려주세요.

미디어위키:Gadget-OWLink.js: 두 판 사이의 차이

리버티게임(개발), 모두가 만들어가는 자유로운 게임
imported>Senouis
Secure CGI 소도구 분할
 
imported>Senouis
1월1일 hsl0님 요청
 
(같은 사용자의 중간 판 3개는 보이지 않습니다)
1번째 줄: 1번째 줄:
/** [[틀:SCGI]]에서 사용하는 링크 리다이렉트 함수
/** [[틀:일방통행링크]]에서 사용하는 링크 리다이렉트 함수
  * class="scgi-use"
  * class="OWLink-container"
  * 작성자: [[사용자:Gustmd7410|Gustmd7410]]
  * 작성자: [[사용자:hsl0|hsl0]]
**/
**/
$(function useSCGI() {
$(function useOWLink() {
if(!URLSearchParams) return;
$('.OWLink-container a').each(function() {
$('.scgi-use a').each(function() {
var href = new URL(this.href);
var href = new URL(this.href);
var params = new URLSearchParams(location.search);
if(
if(location.host === href.host) $(this).click(function(event) {
location.host === href.host && (
location.pathname === '/w/index.php' && params.get('title') ||
location.pathname.startsWith('/wiki/') && location.pathname.replace('/wiki/', '')
) === (
href.pathname === '/w/index.php' && params.searchParams.get('title') ||
href.pathname.startsWith('/wiki/') && href.pathname.replace('/wiki/', '')
) && params.get('action') === href.searchParams.get('action')
) $(this).click(function(event) {
event.preventDefault();
event.preventDefault();
location.replace(event.currentTarget.href);
location.replace(event.currentTarget.href);
});
}).addClass('OWLink');
else this.classList.add('OWLink-no');
});
});
});
});
/* [[틀:SCGI]]에서 사용하는 링크 리다이렉트 함수 끝 */

2021년 1월 1일 (금) 12:36 기준 최신판

/** [[틀:일방통행링크]]에서 사용하는 링크 리다이렉트 함수
 * class="OWLink-container"
 * 작성자: [[사용자:hsl0|hsl0]]
**/
$(function useOWLink() {
	$('.OWLink-container a').each(function() {
		var href = new URL(this.href);
		
		if(location.host === href.host) $(this).click(function(event) {
			event.preventDefault();
			location.replace(event.currentTarget.href);
		}).addClass('OWLink');
		else this.classList.add('OWLink-no');
	});
});